From acccc9c92d7bfdb7d386c9c0d27bc4b1246ecbd1 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sat, 5 Oct 2024 07:44:05 -0600 Subject: [PATCH] cmake: make install path configurable --- CMakeLists.txt | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 294655fa1..2c854993a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,10 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30.0) cmake_policy(SET CMP0167 OLD) endif() +# use gnu standard install directories +include(GNUInstallDirs) +set(ARBORX_INSTALL_PACKAGEDIR "${CMAKE_INSTALL_DATADIR}/cmake/ArborX" CACHE PATH "Install location of CMake target files") + find_package(Kokkos 4.3 REQUIRED CONFIG) message(STATUS "Found Kokkos: ${Kokkos_DIR} (version \"${Kokkos_VERSION}\")") @@ -79,12 +83,12 @@ target_include_directories(ArborX INTERFACE $ $ $ - $ - $ - $ - $ - $ - $ + $ + $ + $ + $ + $ + $ ) install(TARGETS ArborX @@ -94,7 +98,7 @@ install(TARGETS ArborX install(EXPORT ArborXTargets NAMESPACE ArborX:: - DESTINATION lib/cmake/ArborX + DESTINATION ${ARBORX_INSTALL_PACKAGEDIR} ) set(ARBORX_VERSION_STRING "2.0 (dev)") @@ -129,7 +133,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/ArborXSettings.cmake.in include(CMakePackageConfigHelpers) configure_package_config_file(cmake/ArborXConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/ArborXConfig.cmake - INSTALL_DESTINATION lib/cmake/ArborX + INSTALL_DESTINATION ${ARBORX_INSTALL_PACKAGEDIR} ) write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/ArborXConfigVersion.cmake VERSION ${ARBORX_VERSION_STRING} @@ -139,17 +143,17 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/ArborXConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/ArborXConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/ArborXSettings.cmake - DESTINATION lib/cmake/ArborX ) + DESTINATION ${ARBORX_INSTALL_PACKAGEDIR} ) if(ARBORX_ENABLE_MPI) - install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION include/ArborX + install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ArborX FILES_MATCHING PATTERN "*.hpp") else() - install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION include/ArborX + install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ArborX FILES_MATCHING PATTERN "*.hpp" PATTERN "*Distribut*" EXCLUDE) endif() -install(DIRECTORY ${PROJECT_BINARY_DIR}/include/ DESTINATION include/ArborX +install(DIRECTORY ${PROJECT_BINARY_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ArborX FILES_MATCHING PATTERN "*.hpp") if(NOT CMAKE_BUILD_TYPE)