Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use cmake GNUInstallDirs variables #680

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,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 @@ -139,7 +143,7 @@ target_include_directories(
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated>"
"$<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_include_directories(ddc_splines SYSTEM INTERFACE ${LAPACKE_INCLUDE_DIRS})
target_link_libraries(
Expand All @@ -237,7 +241,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 @@ -278,14 +282,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 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 @@ -301,5 +305,5 @@ install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfigVersion.cmake
DESTINATION lib/cmake/DDC
DESTINATION ${DDC_INSTALL_CMAKEDIR}
)