Skip to content

Commit dfcf141

Browse files
committed
Fixes #775: Use target_source(FILE_SET HEADERS) instead of target_include_directories() and...
not matching `*.cuh` in header search - we don't offer device-side headers.
1 parent 81a20e3 commit dfcf141

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

CMakeLists.txt

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,16 @@ endforeach()
4949
set(prefixed-targets "")
5050
set(caw_namespace "cuda-api-wrappers")
5151

52+
file(GLOB_RECURSE headers CONFIGURE_DEPENDS src/*.hpp src/*.h)
5253
foreach(wrapper_lib ${targets})
5354
# First ugly hack to facilitate FetchContent use:
5455
# Prefix target names with something project-specific
5556
set(caw_lib "caw_${wrapper_lib}")
5657
add_library(${caw_lib} INTERFACE)
5758
target_compile_features(${caw_lib} INTERFACE cxx_std_11) # This means _at least_ C++11
58-
target_include_directories(
59-
${caw_lib}
60-
INTERFACE
61-
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>"
62-
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
59+
target_sources(${caw_lib} INTERFACE FILE_SET HEADERS
60+
BASE_DIRS src
61+
FILES ${headers}
6362
)
6463
target_link_libraries(${caw_lib} INTERFACE CUDA::cuda_driver)
6564
string(REGEX MATCH "_static\$" static_suffix ${wrapper_lib})
@@ -183,6 +182,7 @@ install(FILES "${PROJECT_SOURCE_DIR}/cmake/cuda-api-wrappers-config.cmake"
183182
install(
184183
TARGETS ${prefixed-targets}
185184
EXPORT cuda-api-wrappers_export
185+
FILE_SET HEADERS
186186
)
187187

188188
export(
@@ -191,12 +191,6 @@ export(
191191
FILE "${PROJECT_BINARY_DIR}/cuda-api-wrappers-targets.cmake"
192192
)
193193

194-
install(
195-
DIRECTORY src/cuda
196-
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}"
197-
FILES_MATCHING REGEX "\\.(h|hpp|cuh)$"
198-
)
199-
200194
install(
201195
EXPORT cuda-api-wrappers_export
202196
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cuda-api-wrappers"

0 commit comments

Comments
 (0)