[libcxx-commits] [PATCH] D107895: [runtimes] Set more paths when building runtimes standalone

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Aug 11 04:53:16 PDT 2021


mstorsjo created this revision.
mstorsjo added a reviewer: phosek.
Herald added a subscriber: mgorny.
mstorsjo requested review of this revision.
Herald added a project: libc++.
Herald added a reviewer: libc++.

These paths are needed when building with per-target runtime directories.

(It's possible to fix this by manually setting these when invoking
cmake, but one isn't supposed to need to do that.)

Also set LLVM_TOOLS_BINARY_DIR while touching this area (as it's
also unset in this case) even if it isn't specifically needed by the
per-target runtime configuration.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107895

Files:
  libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
  runtimes/CMakeLists.txt


Index: runtimes/CMakeLists.txt
===================================================================
--- runtimes/CMakeLists.txt
+++ runtimes/CMakeLists.txt
@@ -58,6 +58,12 @@
   endif()
 endif()
 
+if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
+  set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+  set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
+  set(LLVM_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/lib)
+endif()
+
 # Setting these variables will allow the sub-build to put their outputs into
 # the library and bin directories of the top-level build.
 set(LLVM_LIBRARY_OUTPUT_INTDIR ${LLVM_LIBRARY_DIR})
Index: libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
===================================================================
--- libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -14,6 +14,8 @@
 set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
 set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
 set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
+set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_CURRENT_BINARY_DIR}/lib")
 
 if (EXISTS "${LLVM_CMAKE_PATH}")
   list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107895.365722.patch
Type: text/x-patch
Size: 1221 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20210811/51cb5e6d/attachment.bin>


More information about the libcxx-commits mailing list