summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCUDACompiler.cmake
diff options
context:
space:
mode:
authorRobert Maynard <robert.maynard@kitware.com>2020-01-01 13:39:20 (GMT)
committerRobert Maynard <robert.maynard@kitware.com>2020-01-10 21:14:28 (GMT)
commitef4a66d69497e2f313aa87cbb52c7a48a8223711 (patch)
treea850e0ccb3017c2a2dfeaa3b85d941f510687382 /Modules/CMakeDetermineCUDACompiler.cmake
parent47a907413bb8aa2394a3003c90775b402b53d35a (diff)
downloadCMake-ef4a66d69497e2f313aa87cbb52c7a48a8223711.zip
CMake-ef4a66d69497e2f313aa87cbb52c7a48a8223711.tar.gz
CMake-ef4a66d69497e2f313aa87cbb52c7a48a8223711.tar.bz2
CUDA: MSVC generators fill CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
Fixes #18733 Correct an oversight where the MSVC generators didn't populate CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES.
Diffstat (limited to 'Modules/CMakeDetermineCUDACompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake51
1 files changed, 25 insertions, 26 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 490d659..7d7fb9a 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -186,33 +186,32 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
"Failed to parsed CUDA nvcc implicit link information:\n${_nvcc_log}\n\n")
message(FATAL_ERROR "Failed to extract nvcc implicit link line.")
endif()
+endif()
- set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
- if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
- set(_nvcc_includes "${CMAKE_MATCH_1}")
- string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
- else()
- set(_nvcc_includes "")
- string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
- string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
- endif()
- if(_nvcc_includes)
- # across all operating system each include directory is prefixed with -I
- separate_arguments(_nvcc_output UNIX_COMMAND "${_nvcc_includes}")
- foreach(line IN LISTS _nvcc_output)
- string(REGEX REPLACE "^-I" "" line "${line}")
- get_filename_component(line "${line}" ABSOLUTE)
- list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
- endforeach()
-
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
- else()
- file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
- "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
- endif()
-
-
+set(CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES )
+string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
+if(_nvcc_output_orig MATCHES "#\\\$ +INCLUDES= *([^\n]*)\n")
+ set(_nvcc_includes "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'INCLUDES=' string: [${_nvcc_includes}]\n")
+else()
+ set(_nvcc_includes "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'INCLUDES=' string found in nvcc output:${_nvcc_output_log}\n")
+endif()
+if(_nvcc_includes)
+ # across all operating system each include directory is prefixed with -I
+ separate_arguments(_nvcc_output NATIVE_COMMAND "${_nvcc_includes}")
+ foreach(line IN LISTS _nvcc_output)
+ string(REGEX REPLACE "^-I" "" line "${line}")
+ get_filename_component(line "${line}" ABSOLUTE)
+ list(APPEND CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES "${line}")
+ endforeach()
+
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Parsed CUDA nvcc include information from above output:\n${_nvcc_log}\n${log}\n\n")
+else()
+ file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Failed to detect CUDA nvcc include information:\n${_nvcc_log}\n\n")
endif()
# configure all variables set in this file