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
This commit is contained in:
River Riddle
2019-05-29 13:47:24 -07:00
committed by Mehdi Amini
parent 16ebc48c9d
commit bffba61d48

View File

@@ -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})