From a799ecb5504dfaf96984c9cdd15a312e14be4093 Mon Sep 17 00:00:00 2001 From: Jonathan Steffan Date: Tue, 14 May 2024 20:26:29 -0600 Subject: [PATCH] Use GNUInstallDirs. --- CMakeLists.txt | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 74dec0826..de6d66ff1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -130,8 +130,9 @@ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake @ONLY IMMEDIATE ) ####################################################### ## Install headers / targets +include(GNUInstallDirs) # This relative path allows installed files to be relocatable. -set( CMAKECONFIG_INSTALL_DIR lib/cmake/${PROJECT_NAME} ) +set( CMAKECONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) file( RELATIVE_PATH REL_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKECONFIG_INSTALL_DIR}" "${CMAKE_INSTALL_PREFIX}/include" @@ -140,10 +141,10 @@ file( RELATIVE_PATH REL_INCLUDE_DIR install( TARGETS ${component_list} EXPORT ${PROJECT_NAME}Targets - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(