summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-05 11:36:48 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-10-05 11:36:53 (GMT)
commit4ffa4ddd8078918583fc03302fa3c3db2c1ca733 (patch)
tree403182dfd8bc4c8e5cdcd5f1d6d1ddc74608eaa7 /Modules
parent69257d456a0b924adb4b14eecfc6d53cc5f3e2e9 (diff)
parent7914fb82234a9b94ca32879763623bb7c8a4e008 (diff)
downloadCMake-4ffa4ddd8078918583fc03302fa3c3db2c1ca733.zip
CMake-4ffa4ddd8078918583fc03302fa3c3db2c1ca733.tar.gz
CMake-4ffa4ddd8078918583fc03302fa3c3db2c1ca733.tar.bz2
Merge topic 'cuda-default-link-launcher'
7914fb82 CUDA: Fix default selection of host compiler used to drive linking Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1341
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake30
1 files changed, 29 insertions, 1 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 89ac9fa..c9cd7e2 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -87,6 +87,15 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio")
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")
+ set(_nvcc_path "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " found 'PATH=' string: [${_nvcc_path}]\n")
+ string(REPLACE ":" ";" _nvcc_path "${_nvcc_path}")
+ else()
+ set(_nvcc_path "")
+ string(REPLACE "\n" "\n " _nvcc_output_log "\n${_nvcc_output_orig}")
+ string(APPEND _nvcc_log " no 'PATH=' string found in nvcc output:${_nvcc_output_log}\n")
+ endif()
if(_nvcc_output_orig MATCHES "#\\\$ +LIBRARIES= *([^\n]*)\n")
set(_nvcc_libraries "${CMAKE_MATCH_1}")
string(APPEND _nvcc_log " found 'LIBRARIES=' string: [${_nvcc_libraries}]\n")
@@ -131,7 +140,26 @@ elseif(CMAKE_CUDA_COMPILER_ID STREQUAL NVIDIA)
else()
#extract the compiler that is being used for linking
separate_arguments(_nvcc_link_line_args UNIX_COMMAND "${_nvcc_link_line}")
- list(GET _nvcc_link_line_args 0 CMAKE_CUDA_HOST_LINK_LAUNCHER)
+ list(GET _nvcc_link_line_args 0 _nvcc_host_link_launcher)
+ if(IS_ABSOLUTE "${_nvcc_host_link_launcher}")
+ string(APPEND _nvcc_log " extracted link launcher absolute path: [${_nvcc_host_link_launcher}]\n")
+ set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
+ else()
+ string(APPEND _nvcc_log " extracted link launcher name: [${_nvcc_host_link_launcher}]\n")
+ find_program(_nvcc_find_host_link_launcher
+ NAMES ${_nvcc_host_link_launcher}
+ PATHS ${_nvcc_path} NO_DEFAULT_PATH)
+ find_program(_nvcc_find_host_link_launcher
+ NAMES ${_nvcc_host_link_launcher})
+ if(_nvcc_find_host_link_launcher)
+ string(APPEND _nvcc_log " found link launcher absolute path: [${_nvcc_find_host_link_launcher}]\n")
+ set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_find_host_link_launcher}")
+ else()
+ string(APPEND _nvcc_log " could not find link launcher absolute path\n")
+ set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${_nvcc_host_link_launcher}")
+ endif()
+ unset(_nvcc_find_host_link_launcher CACHE)
+ endif()
endif()
#prefix the line with cuda-fake-ld so that implicit link info believes it is