[MLIR] Fix Xcode build due to incorrect library path

Two MLIR examples do not link because the library path is different when using Xcode vs Makefiles.
This change adds the configuration name to the library path when building with Xcode.

i.e. LLVM_BUILD_DIR/debug/lib
This commit is contained in:
Aaron Smith 2020-03-20 16:38:16 -07:00
parent 6aef702ab6
commit aa1e0e01d8
1 changed files with 5 additions and 1 deletions

View File

@ -11,7 +11,11 @@ function(whole_archive_link target)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(link_flags "-L${CMAKE_BINARY_DIR}/lib ")
FOREACH(LIB ${ARGN})
string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ")
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lib/lib${LIB}.a ")
else()
string(CONCAT link_flags ${link_flags} "-Wl,-force_load ${CMAKE_BINARY_DIR}/lib/lib${LIB}.a ")
endif()
ENDFOREACH(LIB)
elseif(MSVC)
FOREACH(LIB ${ARGN})