mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-20 22:20:50 -06:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user