diff options
Diffstat (limited to 'Modules/CMakeParseImplicitLinkInfo.cmake')
-rw-r--r-- | Modules/CMakeParseImplicitLinkInfo.cmake | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index 1d0030c..3b77278 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -18,9 +18,13 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj get_filename_component(linker ${CMAKE_LINKER} NAME) string(REGEX REPLACE "([][+.*?()^$])" "\\\\\\1" linker "${linker}") endif() + set(startfile "CMAKE_LINK_STARTFILE-NOTFOUND") + if(CMAKE_LINK_STARTFILE) + set(startfile "${CMAKE_LINK_STARTFILE}") + endif() # Construct a regex to match linker lines. It must match both the # whole line and just the command (argv[0]). - set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") + set(linker_regex "^( *|.*[/\\])(${linker}|${startfile}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ") string(APPEND log " link line regex: [${linker_regex}]\n") string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") @@ -55,9 +59,9 @@ 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:(.+)") + elseif("${arg}" MATCHES "^[-/](LIBPATH|libpath):(.+)") # MSVC search path. - set(dir "${CMAKE_MATCH_1}") + set(dir "${CMAKE_MATCH_2}") list(APPEND implicit_dirs_tmp ${dir}) string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") elseif(is_msvc AND "${arg}" STREQUAL "-link") @@ -79,6 +83,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # Unix library full path. list(APPEND implicit_libs_tmp ${arg}) string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") + elseif("${arg}" MATCHES "^[-/](DEFAULTLIB|defaultlib):(.+)") + # Windows library. + set(lib "${CMAKE_MATCH_2}") + list(APPEND implicit_libs_tmp ${lib}) + string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$" AND obj_regex AND "${arg}" MATCHES "${obj_regex}") # Object file full path. @@ -133,7 +142,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # We remove items that are not language-specific. set(implicit_libs "") foreach(lib IN LISTS implicit_libs_tmp) - if("x${lib}" MATCHES "^x(crt.*\\.o|System.*|.*libclang_rt.*)$") + if("x${lib}" MATCHES "^x(crt.*\\.o|System.*|.*libclang_rt.*|msvcrt.*|libvcruntime.*|libucrt.*|libcmt.*)$") string(APPEND log " remove lib [${lib}]\n") elseif(IS_ABSOLUTE "${lib}") get_filename_component(abs "${lib}" ABSOLUTE) |