From 7a2704ffbfc001449ff7d9261f262d2f3b696866 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 8 Apr 2021 20:15:45 -0400 Subject: [PATCH] CMakeLists.txt: support standard GNU installation directories Modern systems have varied naming schemes for their 32- and 64-bit library directories. For example, Gentoo uses /usr/lib for 32-bit libraries and /usr/lib64 for 64-bit libraries. The current default of "lib" in CMakeLists.txt is therefore inappropriate in the common case of a 64-bit build on Gentoo. Debian makes a similar (but different) distinction. This commit uses the GNUInstallDirs module to determine the library directory, as well as all of the other standard GNU installation directories. A sensible default exists, but the user now has the ability to override these directories with the values appropriate for his system. Distributions, in particular, can pass these values to the build system in a consistent way. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ec806fe8..d6136a8f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,10 +136,12 @@ if(NOT MSVC) target_link_libraries(arb m) endif() +include(GNUInstallDirs) + install(TARGETS arb - RUNTIME DESTINATION bin - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib + RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" + LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}" ) foreach (FOLDER ${FOLDERS})