diff --git a/CMakeLists.txt b/CMakeLists.txt index 43654110267..347269664ce 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -615,20 +615,15 @@ set(MASTER_HEADERS ${PROJECT_SOURCE_DIR}/mfem.hpp ${PROJECT_SOURCE_DIR}/mfem-performance.hpp) -# Installation options -set(MFEM_USE_GNUINSTALLDIRS OFF - CACHE BOOL "Enable to use the GNUInstallDirs CMake module.") -set(install_include_dir_default include) -set(install_bin_dir_default bin) -set(install_lib_dir_default lib) -set(install_share_dir_default share) -if (MFEM_USE_GNUINSTALLDIRS) - include(GNUInstallDirs) - set(install_include_dir_default "${CMAKE_INSTALL_INCLUDEDIR}") - set(install_bin_dir_default "${CMAKE_INSTALL_BINDIR}") - set(install_lib_dir_default "${CMAKE_INSTALL_LIBDIR}") - set(install_share_dir_default "${CMAKE_INSTALL_DATAROOTDIR}") -endif() +# Installation options (we use GNUInstallDirs but prefer lib on all platforms) +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR lib CACHE PATH "Object code libraries (lib)") +endif() +include(GNUInstallDirs) +set(install_include_dir_default "${CMAKE_INSTALL_INCLUDEDIR}") +set(install_bin_dir_default "${CMAKE_INSTALL_BINDIR}") +set(install_lib_dir_default "${CMAKE_INSTALL_LIBDIR}") +set(install_share_dir_default "${CMAKE_INSTALL_DATAROOTDIR}") mfem_cache_path(INSTALL_INCLUDE_DIR "${install_include_dir_default}" "Relative or absolute path for installing header files.") mfem_cache_path(INSTALL_BIN_DIR "${install_bin_dir_default}" diff --git a/INSTALL b/INSTALL index 6b7fc3c86c5..2a24aa0ad9d 100644 --- a/INSTALL +++ b/INSTALL @@ -973,8 +973,10 @@ Note that running all the tests may take a while. Installation prefix can be configured by setting the standard CMake variable CMAKE_INSTALL_PREFIX; for fine-tuning the installation directories the following variables can be used: INSTALL_INCLUDE_DIR, INSTALL_LIB_DIR, INSTALL_BIN_DIR, -INSTALL_SHARE_DIR, and INSTALL_CMAKE_DIR; alternatively, fine-tuning can be done -by setting MFEM_USE_GNUINSTALLDIRS=ON to use the CMake module GNUInstallDirs. +INSTALL_SHARE_DIR, and INSTALL_CMAKE_DIR; alternatively, and with lower precedence, +one can also use the variables defined by the CMake-provided GNUInstallDirs module: +CMAKE_INSTALL_INCLUDEDIR, CMAKE_INSTALL_LIBDIR, CMAKE_INSTALL_BINDIR and +CMAKE_INSTALL_DATAROOTDIR. To install the library, use make install