From 82a01005d3bb3d03ea5db874a33dec98dc49b080 Mon Sep 17 00:00:00 2001 From: Christoph Junghans Date: Sat, 5 Oct 2024 07:23:17 -0600 Subject: [PATCH] cmake: allow to customize location of CMake target files --- CMakeLists.txt | 5 +++-- core/src/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 94ed7d043..1cd8323bf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ option(CMAKE_VERBOSE_MAKEFILE "Generate verbose Makefiles" OFF) # use gnu standard install directories include(GNUInstallDirs) +set(Cabana_INSTALL_PACKAGEDIR "${CMAKE_INSTALL_DATADIR}/cmake/Cabana" CACHE PATH "Install location of CMake target files") # point to cmake modules set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) @@ -97,7 +98,7 @@ Cabana_add_dependency( PACKAGE SILO ) if(SILO_FOUND) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/FindSILO.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cabana ) + DESTINATION ${Cabana_INSTALL_PACKAGEDIR} ) endif() # find HDF5 (XDMF) @@ -268,7 +269,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/CabanaConfig.cmakein ${CMAKE_CURRENT_BINARY_DIR}/CabanaConfig.cmake @ONLY) install(FILES "${CMAKE_CURRENT_BINARY_DIR}/CabanaConfig.cmake" "${CMAKE_CURRENT_BINARY_DIR}/CabanaConfigVersion.cmake" - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cabana) + DESTINATION ${Cabana_INSTALL_PACKAGEDIR}) ##---------------------------------------------------------------------------## ## Clang Format diff --git a/core/src/CMakeLists.txt b/core/src/CMakeLists.txt index a37a22aee..922aac53b 100644 --- a/core/src/CMakeLists.txt +++ b/core/src/CMakeLists.txt @@ -112,7 +112,7 @@ install(TARGETS Core install(EXPORT Cabana_Targets FILE Cabana_Targets.cmake NAMESPACE Cabana:: - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Cabana) + DESTINATION ${Cabana_INSTALL_PACKAGEDIR}) install(FILES ${HEADERS_PUBLIC} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})