[Mlir-commits] [mlir] aa1e0e0 - [MLIR] Fix Xcode build due to incorrect library path

Aaron Smith llvmlistbot at llvm.org
Fri Mar 20 16:38:29 PDT 2020


Author: Aaron Smith
Date: 2020-03-20T16:38:16-07:00
New Revision: aa1e0e01d89d490fca5861efa4874ca998f6503f

URL: https://github.com/llvm/llvm-project/commit/aa1e0e01d89d490fca5861efa4874ca998f6503f
DIFF: https://github.com/llvm/llvm-project/commit/aa1e0e01d89d490fca5861efa4874ca998f6503f.diff

LOG: [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

Added: 
    

Modified: 
    mlir/cmake/modules/AddMLIR.cmake

Removed: 
    


################################################################################
diff  --git a/mlir/cmake/modules/AddMLIR.cmake b/mlir/cmake/modules/AddMLIR.cmake
index 4e06a0e743fe..e9101ed25dca 100644
--- a/mlir/cmake/modules/AddMLIR.cmake
+++ b/mlir/cmake/modules/AddMLIR.cmake
@@ -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})


        


More information about the Mlir-commits mailing list