@@ -730,7 +730,7 @@ else()
730
730
endif ()
731
731
732
732
# Set the user list of include dir to nothing to initialize it.
733
- set (CUDA_NVCC_INCLUDE_ARGS_USER "" )
733
+ set (CUDA_NVCC_INCLUDE_DIRS_USER "" )
734
734
set (CUDA_INCLUDE_DIRS ${CUDA_TOOLKIT_INCLUDE} )
735
735
736
736
macro (cuda_find_library_local_first_with_path_ext _var _names _doc _path_ext )
@@ -1025,7 +1025,7 @@ find_package_handle_standard_args(CUDA
1025
1025
# Add include directories to pass to the nvcc command.
1026
1026
macro (CUDA_INCLUDE_DIRECTORIES)
1027
1027
foreach (dir ${ARGN} )
1028
- list (APPEND CUDA_NVCC_INCLUDE_ARGS_USER -I ${dir} )
1028
+ list (APPEND CUDA_NVCC_INCLUDE_DIRS_USER ${dir} )
1029
1029
endforeach ()
1030
1030
endmacro ()
1031
1031
@@ -1249,17 +1249,15 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
1249
1249
endif ()
1250
1250
1251
1251
# Initialize our list of includes with the user ones followed by the CUDA system ones.
1252
- set (CUDA_NVCC_INCLUDE_ARGS ${CUDA_NVCC_INCLUDE_ARGS_USER} "-I${CUDA_INCLUDE_DIRS} " )
1253
- # Get the include directories for this directory and use them for our nvcc command.
1254
- # Remove duplicate entries which may be present since include_directories
1255
- # in CMake >= 2.8.8 does not remove them.
1256
- get_directory_property (CUDA_NVCC_INCLUDE_DIRECTORIES INCLUDE_DIRECTORIES )
1257
- list (REMOVE_DUPLICATES CUDA_NVCC_INCLUDE_DIRECTORIES)
1258
- if (CUDA_NVCC_INCLUDE_DIRECTORIES)
1259
- foreach (dir ${CUDA_NVCC_INCLUDE_DIRECTORIES} )
1260
- list (APPEND CUDA_NVCC_INCLUDE_ARGS -I${dir} )
1261
- endforeach ()
1262
- endif ()
1252
+ set (CUDA_NVCC_INCLUDE_DIRS ${CUDA_NVCC_INCLUDE_DIRS_USER} "${CUDA_INCLUDE_DIRS} " )
1253
+ # Append the include directories for this target via generator expression, which is
1254
+ # expanded by the FILE(GENERATE) call below. This generator expression captures all
1255
+ # include dirs set by the user, whether via directory properties or target properties
1256
+ list (APPEND CUDA_NVCC_INCLUDE_DIRS "$<TARGET_PROPERTY:${cuda_target} ,INCLUDE_DIRECTORIES>" )
1257
+
1258
+ # Do the same thing with compile definitions
1259
+ set (CUDA_NVCC_COMPILE_DEFINITIONS "$<TARGET_PROPERTY:${cuda_target} ,COMPILE_DEFINITIONS>" )
1260
+
1263
1261
1264
1262
# Reset these variables
1265
1263
set (CUDA_WRAP_OPTION_NVCC_FLAGS)
@@ -1349,14 +1347,6 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files)
1349
1347
string (REGEX REPLACE "[-]+std=c\\ +\\ +11" "" _cuda_host_flags "${_cuda_host_flags} " )
1350
1348
endif ()
1351
1349
1352
- # Get the list of definitions from the directory property
1353
- get_directory_property (CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS )
1354
- if (CUDA_NVCC_DEFINITIONS)
1355
- foreach (_definition ${CUDA_NVCC_DEFINITIONS} )
1356
- list (APPEND nvcc_flags "-D${_definition} " )
1357
- endforeach ()
1358
- endif ()
1359
-
1360
1350
if (_cuda_build_shared_libs)
1361
1351
list (APPEND nvcc_flags "-D${cuda_target} _EXPORTS" )
1362
1352
endif ()
0 commit comments