summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-11-02 13:35:45 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-11-02 13:35:57 (GMT)
commit3a926cba6c75c624e5c2edea883ca4828262e9c4 (patch)
tree68c3e36c1dcbf65ed32fa5486c40c1d200e6ac97
parent0f02655bb01346cab483761bd75fa8dc6cbfe7f1 (diff)
parentf0feefceb33b7801908fe2d3ecbc07f39965e633 (diff)
downloadCMake-3a926cba6c75c624e5c2edea883ca4828262e9c4.zip
CMake-3a926cba6c75c624e5c2edea883ca4828262e9c4.tar.gz
CMake-3a926cba6c75c624e5c2edea883ca4828262e9c4.tar.bz2
Merge topic 'cuda-vs'
f0feefceb3 Merge branch 'backport-cuda-vs' into cuda-vs 79f3f29e50 CUDA: Parse NVCC implicit compile/link information in Visual Studio generators 27e64a8498 CMakeNVCCParseImplicitInfo: Recognize link.exe line in CUDA VS integration 677992d85a CMakeParseImplicitLinkInfo: Log exclusion of MSVC link /implib: flag 045399a461 CMakeParseImplicitLinkInfo: Ignore MSVC link /implib: flag Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Robert Maynard <robertjmaynard@gmail.com> Merge-request: !8938
-rw-r--r--Modules/CMakeDetermineCUDACompiler.cmake21
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake5
-rw-r--r--Modules/Internal/CMakeNVCCParseImplicitInfo.cmake3
3 files changed, 7 insertions, 22 deletions
diff --git a/Modules/CMakeDetermineCUDACompiler.cmake b/Modules/CMakeDetermineCUDACompiler.cmake
index 585b2aa..6ac4dad 100644
--- a/Modules/CMakeDetermineCUDACompiler.cmake
+++ b/Modules/CMakeDetermineCUDACompiler.cmake
@@ -164,26 +164,7 @@ if(MSVC_CUDA_ARCHITECTURE_ID)
"set(MSVC_CUDA_ARCHITECTURE_ID ${MSVC_CUDA_ARCHITECTURE_ID})")
endif()
-if(CMAKE_GENERATOR MATCHES "Visual Studio")
- set(CMAKE_CUDA_HOST_LINK_LAUNCHER "${CMAKE_LINKER}")
- set(CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES "")
- set(CMAKE_CUDA_HOST_IMPLICIT_LINK_DIRECTORIES "")
- set(CMAKE_CUDA_HOST_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "")
-
- # We do not currently detect CMAKE_CUDA_HOST_IMPLICIT_LINK_LIBRARIES but we
- # do need to detect CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT from the compiler by
- # looking at which cudart library exists in the implicit link libraries passed
- # to the host linker.
- if(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart_static\\.lib")
- set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "STATIC")
- elseif(CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT MATCHES "link\\.exe [^\n]*cudart\\.lib")
- set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "SHARED")
- else()
- set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT "NONE")
- endif()
- set(_SET_CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT
- "set(CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT \"${CMAKE_CUDA_RUNTIME_LIBRARY_DEFAULT}\")")
-elseif(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
+if(CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
string(REGEX MATCHALL "-target-cpu sm_([0-9]+)" _clang_target_cpus "${CMAKE_CUDA_COMPILER_PRODUCED_OUTPUT}")
foreach(_clang_target_cpu ${_clang_target_cpus})
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index a513faf..b48eb43 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -161,8 +161,9 @@ function(cmake_parse_implicit_link_info2 text log_var obj_regex)
endif()
elseif(is_msvc AND "${arg}" STREQUAL "-link")
string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n")
- elseif(is_msvc AND NOT "${arg}" MATCHES "^/[Ii][Mm][Pp][Ll][Ii][Bb]:"
- AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
+ elseif(is_msvc AND "${arg}" MATCHES "^[-/][Ii][Mm][Pp][Ll][Ii][Bb]:")
+ string(APPEND log " arg [${arg}] ==> ignore MSVC link option\n")
+ elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
if(EXTRA_PARSE_COMPUTE_IMPLICIT_LIBS)
set(lib "${CMAKE_MATCH_1}")
list(APPEND implicit_libs_tmp ${lib})
diff --git a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
index 32ff28a..3aa10a2 100644
--- a/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
+++ b/Modules/Internal/CMakeNVCCParseImplicitInfo.cmake
@@ -52,6 +52,9 @@ macro(cmake_nvcc_parse_implicit_info lang lang_var_)
string(APPEND _nvcc_log " considering line: [${_nvcc_output_line}]\n")
if("${_nvcc_output_line}" MATCHES "^ *nvlink")
string(APPEND _nvcc_log " ignoring nvlink line\n")
+ elseif("${_nvcc_output_line}" MATCHES "(link\\.exe .*CompilerId${lang}\\.exe.*)$")
+ set(_nvcc_link_line "${CMAKE_MATCH_1}")
+ string(APPEND _nvcc_log " extracted link line: [${_nvcc_link_line}]\n")
elseif(_nvcc_libraries)
if("${_nvcc_output_line}" MATCHES "(@\"?((tmp/)?a\\.exe\\.res)\"?)")
set(_nvcc_link_res_arg "${CMAKE_MATCH_1}")