summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeParseImplicitLinkInfo.cmake15
-rw-r--r--Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in7
2 files changed, 22 insertions, 0 deletions
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake
index 2031ba5..3469d34 100644
--- a/Modules/CMakeParseImplicitLinkInfo.cmake
+++ b/Modules/CMakeParseImplicitLinkInfo.cmake
@@ -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()
diff --git a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
index 1313dbf..d6d2357 100644
--- a/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
+++ b/Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in
@@ -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.