[PATCH] D153373: WIP: Define/guard MLIR_STANDALONE_BUILD LLVM_LIBRARY_OUTPUT_INTDIR var.
Stella Laurenzo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 20 13:08:13 PDT 2023
stellaraccident created this revision.
Herald added subscribers: llvm-commits, bviyer, Moerafaat, zero9178, bzcheeseman, sdasgup3, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini.
Herald added projects: MLIR, LLVM, All.
stellaraccident requested review of this revision.
Herald added subscribers: stephenneuendorffer, nicolasvasilache.
It looks like MLIR is using the more modern CMAKE_LIBRARY_OUTPUT_DIRECTORY, but AddLLVM still uses this older LLVM specific alias.
In the specific case I was running into, the empty variable was causing `-Wl,-rpath-link,` on the command line, causing the following argument to be swallowed. This was maddening, because the following argument was the .o file containing `main` and I was getting `main` undefined errors when it was clearly there. This is egregious enough that I chose to guard it.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D153373
Files:
llvm/cmake/modules/AddLLVM.cmake
mlir/CMakeLists.txt
Index: mlir/CMakeLists.txt
===================================================================
--- mlir/CMakeLists.txt
+++ mlir/CMakeLists.txt
@@ -35,6 +35,11 @@
"${CMAKE_CURRENT_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
+ # Some LLVM CMake utilities use these aliases for the CMake builtin variables.
+ # We set them for compatibility.
+ set(LLVM_LIBRARY_OUTPUT_INTDIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
+ set(LLVM_RUNTIME_OUTPUT_INTDIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+
set(LLVM_LIT_ARGS "-sv" CACHE STRING "Default options for lit")
endif()
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -2358,6 +2358,9 @@
endif()
if(LLVM_LINKER_IS_GNULD)
# $ORIGIN is not interpreted at link time by ld.bfd
+ if(NOT LLVM_LIBRARY_OUTPUT_INTDIR)
+ message(SEND_ERROR "Project does not define LLVM_LIBRARY_OUTPUT_INTDIR and it is required")
+ endif()
set_property(TARGET ${name} APPEND_STRING PROPERTY
LINK_FLAGS " -Wl,-rpath-link,${LLVM_LIBRARY_OUTPUT_INTDIR} ")
endif()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153373.533026.patch
Type: text/x-patch
Size: 1251 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230620/62f49347/attachment.bin>
More information about the llvm-commits
mailing list