mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-06 14:19:59 -05:00
CMakeParseImplicitLinkInfo: Add support for MSVC invoked by CUDA nvcc
This commit is contained in:
@@ -45,6 +45,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
|
||||
endif()
|
||||
list(GET args 0 cmd)
|
||||
endif()
|
||||
set(is_msvc 0)
|
||||
if("${cmd}" MATCHES "${linker_regex}")
|
||||
string(APPEND log " link line: [${line}]\n")
|
||||
string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}")
|
||||
@@ -54,6 +55,17 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
|
||||
string(REGEX REPLACE "^-L" "" dir "${arg}")
|
||||
list(APPEND implicit_dirs_tmp ${dir})
|
||||
string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
|
||||
elseif("${arg}" MATCHES "^[-/]LIBPATH:(.+)")
|
||||
# MSVC search path.
|
||||
set(dir "${CMAKE_MATCH_1}")
|
||||
list(APPEND implicit_dirs_tmp ${dir})
|
||||
string(APPEND log " arg [${arg}] ==> dir [${dir}]\n")
|
||||
elseif(is_msvc AND "${arg}" STREQUAL "-link")
|
||||
string(APPEND log " arg [${arg}] ==> ignore MSVC cl option\n")
|
||||
elseif(is_msvc AND "${arg}" MATCHES "^(.*\\.[Ll][Ii][Bb])$")
|
||||
set(lib "${CMAKE_MATCH_1}")
|
||||
list(APPEND implicit_libs_tmp ${lib})
|
||||
string(APPEND log " arg [${arg}] ==> lib [${lib}]\n")
|
||||
elseif("${arg}" MATCHES "^-l([^:].*)$")
|
||||
# Unix library.
|
||||
set(lib "${CMAKE_MATCH_1}")
|
||||
@@ -82,6 +94,9 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj
|
||||
# Link editor option.
|
||||
list(APPEND implicit_libs_tmp ${arg})
|
||||
string(APPEND log " arg [${arg}] ==> opt [${arg}]\n")
|
||||
elseif("${arg}" STREQUAL "cl.exe")
|
||||
string(APPEND log " arg [${arg}] ==> recognize MSVC cl\n")
|
||||
set(is_msvc 1)
|
||||
else()
|
||||
string(APPEND log " arg [${arg}] ==> ignore\n")
|
||||
endif()
|
||||
|
||||
@@ -518,6 +518,13 @@ set(msys_g77_libs "frtbegin;g2c;mingw32;moldname;mingwex;msvcrt;user32;kernel32;
|
||||
set(msys_g77_dirs "C:/some-mingw/lib/gcc/mingw32/3.4.5;C:/some-mingw/lib/gcc;/some-mingw/lib;C:/some-mingw/lib")
|
||||
list(APPEND platforms msys_g77)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# MSVC from NVIDIA CUDA
|
||||
|
||||
set(nvcc_msvc_text [[cuda-fake-ld cl.exe -nologo "tmp/a_dlink.obj" "tmp/CMakeCUDACompilerId.obj" -link -INCREMENTAL:NO "/LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/bin/../lib/x64" cudadevrt.lib cudart_static.lib -Fe"a.exe"]])
|
||||
set(nvcc_msvc_libs "cudadevrt.lib;cudart_static.lib")
|
||||
set(nvcc_msvc_dirs "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v8.0/lib/x64")
|
||||
list(APPEND platforms nvcc_msvc)
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Test parsing for all above examples.
|
||||
|
||||
Reference in New Issue
Block a user