Skip to content

Commit

Permalink
Merge pull request #44 from stephenswat/build/install_includedir
Browse files Browse the repository at this point in the history
Fix bug in the CMake install interface
  • Loading branch information
stephenswat authored Nov 15, 2024
2 parents 6a62aff + e58ee41 commit 7f4bbb6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ cmake_minimum_required(VERSION 3.18)

project("covfie" VERSION 0.10.0)

# Load some dependencies.
include(GNUInstallDirs)

# Declare options which control the parts of the code being built.
option(COVFIE_BUILD_BENCHMARKS "Build benchmark executables.")
option(COVFIE_BUILD_TESTS "Build test executables.")
Expand Down Expand Up @@ -59,7 +62,6 @@ endif()

# Installation logic.
# CMake is hell.
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)

write_basic_package_version_file(
Expand Down
6 changes: 5 additions & 1 deletion lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ endif()
# Logic to ensure that the core module can be installed properly.
install(TARGETS core EXPORT ${PROJECT_NAME}Targets)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/covfie DESTINATION include)
install(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/covfie
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

# Hack for people using the disgusting mal-practice of pullling in external
# projects via "add_subdirectory"...
Expand Down
6 changes: 5 additions & 1 deletion lib/cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ target_compile_features(cpu INTERFACE cxx_std_20)
# Logic to ensure that the CPU module can be installed properly.
install(TARGETS cpu EXPORT ${PROJECT_NAME}Targets)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/covfie DESTINATION include)
install(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/covfie
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

target_link_libraries(cpu INTERFACE covfie::core)

Expand Down
6 changes: 5 additions & 1 deletion lib/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ target_link_libraries(
# Logic to ensure that the CUDA module can be installed properly.
install(TARGETS cuda EXPORT ${PROJECT_NAME}Targets)

install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/covfie DESTINATION include)
install(
DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/covfie
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)

# Hack for compatibility
add_library(covfie::cuda ALIAS cuda)
Expand Down

0 comments on commit 7f4bbb6

Please sign in to comment.