summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake53
1 files changed, 28 insertions, 25 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 7d7fb9a..62ea686 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -86,7 +86,7 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
-elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
+elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
set(_nvcc_log "")
string(REPLACE "\r" "" _nvcc_output_orig "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
if(_nvcc_output_orig MATCHES "#\\\$ +PATH= *([^\n]*)\n")
@@ -188,30 +188,33 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
endif()
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")
+# Determine CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "NVIDIA")
+ 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()
endif()
# configure all variables set in this file