[MLIR] Fix ML IR build on Windows with Visual Studio
authorStella Stamenova <stilis@microsoft.com>
Wed, 8 Jan 2020 18:39:20 +0000 (10:39 -0800)
committerStella Stamenova <stilis@microsoft.com>
Wed, 8 Jan 2020 18:40:04 +0000 (10:40 -0800)
Summary: Right now the path for each lib in whole_archive_link when MSVC is used as the compiler is not a full path - and it's not even the correct path when VS is used to build. This patch sets the lib path to a full path using CMAKE_CFG_INTDIR which means the path will be correct regardless of whether ninja, make or VS is used and it will always be a full path.

Reviewers: denis13, jpienaar

Reviewed By: jpienaar

Subscribers: mgorny, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, llvm-commits, asmith

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D72403

mlir/CMakeLists.txt

index 1f30d68..cd4f05f 100644 (file)
@@ -49,7 +49,7 @@ function(whole_archive_link target)
     ENDFOREACH(LIB)
   elseif(MSVC)
     FOREACH(LIB ${ARGN})
-      string(CONCAT link_flags ${link_flags} "/WHOLEARCHIVE:lib/${LIB}.lib ")
+      string(CONCAT link_flags ${link_flags} "/WHOLEARCHIVE:${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/${LIB}.lib ")
     ENDFOREACH(LIB)
   else()
     set(link_flags "-L${CMAKE_BINARY_DIR}/lib -Wl,--whole-archive,")