Skip to content

Commit

Permalink
Use cmake GNUInstallDirs variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Nov 8, 2024
1 parent b627993 commit 5488f16
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ set(DDC_DEPENDENCY_POLICIES "AUTO" "EMBEDDED" "INSTALLED" "SUBPROJECT")

include(CMakePackageConfigHelpers)
include(CTest)
include(GNUInstallDirs)

set(DDC_INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
set(DDC_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})

## Custom cmake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down Expand Up @@ -138,7 +142,7 @@ target_include_directories(
ddc_core
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
"$<INSTALL_INTERFACE:${DDC_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(ddc_core INTERFACE Kokkos::kokkos)

Expand Down Expand Up @@ -214,7 +218,7 @@ if("${DDC_BUILD_KERNELS_SPLINES}")

add_library(ddc_splines INTERFACE)
add_library(DDC::splines ALIAS ddc_splines)
install(FILES cmake/FindLAPACKE.cmake DESTINATION lib/cmake/DDC)
install(FILES cmake/FindLAPACKE.cmake DESTINATION ${DDC_INSTALL_CMAKEDIR})
install(TARGETS ddc_splines EXPORT DDCTargets)
target_compile_definitions(ddc_splines INTERFACE "DDC_BUILD_KERNELS_SPLINES")
target_include_directories(ddc_splines SYSTEM INTERFACE ${LAPACKE_INCLUDE_DIRS})
Expand All @@ -239,7 +243,7 @@ if("${DDC_BUILD_PDI_WRAPPER}")
ddc_pdi
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
"$<INSTALL_INTERFACE:${DDC_INSTALL_INCLUDEDIR}>"
)
target_link_libraries(ddc_pdi INTERFACE DDC::core PDI::PDI_C)

Expand Down Expand Up @@ -280,14 +284,14 @@ endif()

## installation

install(EXPORT DDCTargets NAMESPACE DDC::impl:: DESTINATION lib/cmake/DDC)
install(EXPORT DDCTargets NAMESPACE DDC::impl:: DESTINATION ${DDC_INSTALL_CMAKEDIR})

install(DIRECTORY include/ TYPE INCLUDE)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/ddc TYPE INCLUDE)

configure_package_config_file(
cmake/DDCConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
INSTALL_DESTINATION lib/cmake/DDC
INSTALL_DESTINATION ${DDC_INSTALL_CMAKEDIR}
)

# We use SameMinorVersion until major version 1
Expand All @@ -303,5 +307,5 @@ install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfigVersion.cmake
DESTINATION lib/cmake/DDC
DESTINATION ${DDC_INSTALL_CMAKEDIR}
)

0 comments on commit 5488f16

Please sign in to comment.