diff --git a/CMakeLists.txt b/CMakeLists.txt index 65549e47..87f4cddd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,6 +25,7 @@ option(MI_CHECK_FULL "Use full internal invariant checking in DEBUG mode option(MI_INSTALL_TOPLEVEL "Install directly into $CMAKE_INSTALL_PREFIX instead of PREFIX/lib/mimalloc-version" OFF) option(MI_USE_LIBATOMIC "Explicitly link with -latomic (on older systems)" OFF) +include(GNUInstallDirs) include("cmake/mimalloc-config-version.cmake") set(mi_sources @@ -230,9 +231,9 @@ endif() # ----------------------------------------------------------------------------- if (MI_INSTALL_TOPLEVEL) - set(mi_install_libdir "lib") - set(mi_install_incdir "include") - set(mi_install_cmakedir "cmake") + set(mi_install_libdir "${CMAKE_INSTALL_LIBDIR}") + set(mi_install_incdir "${CMAKE_INSTALL_INCLUDEDIR}") + set(mi_install_cmakedir "${CMAKE_INSTALL_LIBDIR}/cmake/mimalloc") else() set(mi_install_libdir "lib/mimalloc-${mi_version}") set(mi_install_incdir "include/mimalloc-${mi_version}")