From: River Riddle Date: Wed, 29 May 2019 20:47:24 +0000 (-0700) Subject: Add whole_archive_link support for MSVC. X-Git-Tag: llvmorg-11-init~1466^2~1563 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bffba61d4806ae26d7d032b5cb4450bc8db83775;p=platform%2Fupstream%2Fllvm.git Add whole_archive_link support for MSVC. This issue was discovered by @loic-joly-sonarsource with a proposed fix in https://github.com/tensorflow/mlir/pull/22. -- PiperOrigin-RevId: 250558504 --- diff --git a/mlir/CMakeLists.txt b/mlir/CMakeLists.txt index 473191d..4e1b3e5 100644 --- a/mlir/CMakeLists.txt +++ b/mlir/CMakeLists.txt @@ -25,6 +25,10 @@ function(whole_archive_link target) FOREACH(LIB ${ARGN}) string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ") ENDFOREACH(LIB) + elseif(MSVC) + FOREACH(LIB ${ARGN}) + string(CONCAT link_flags ${link_flags} "/WHOLEARCHIVE:${LIB} ") + ENDFOREACH(LIB) else() set(link_flags "-L${CMAKE_BINARY_DIR}/lib -Wl,--whole-archive,") FOREACH(LIB ${ARGN})