[libcxx-commits] [libcxx] 407e07a - [runtimes] Set more paths when building runtimes standalone
Martin Storsjö via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Sep 8 14:02:30 PDT 2021
Author: Martin Storsjö
Date: 2021-09-09T00:01:38+03:00
New Revision: 407e07aa67ab56c92cdec1fdbf6b121afbceddaf
URL: https://github.com/llvm/llvm-project/commit/407e07aa67ab56c92cdec1fdbf6b121afbceddaf
DIFF: https://github.com/llvm/llvm-project/commit/407e07aa67ab56c92cdec1fdbf6b121afbceddaf.diff
LOG: [runtimes] Set more paths when building runtimes standalone
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.
Differential Revision: https://reviews.llvm.org/D107895
Added:
Modified:
libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
runtimes/CMakeLists.txt
Removed:
################################################################################
diff --git a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
index ad2820b324d7..deaa2c3805f2 100644
--- a/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
+++ b/libcxx/cmake/Modules/HandleOutOfTreeLLVM.cmake
@@ -14,6 +14,8 @@ set(LLVM_INCLUDE_DIR ${LLVM_PATH}/include CACHE PATH "Path to llvm/include")
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}")
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 1ffce323d951..418da857ea08 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -58,6 +58,12 @@ if(compiler_rt_path)
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})
More information about the libcxx-commits
mailing list