Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/llvm/llvm-project.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2021-08-11 14:14:31 +0300
committerMartin Storsjö <martin@martin.st>2021-09-09 15:30:42 +0300
commita3870e8ab164e796da4fe48c6abf899d79c09f6d (patch)
tree792446247cbec8e10d29a0fba725c3c1883c4a64 /runtimes
parent312ad74aea4886159472597ed6b2c40dea9e5ca7 (diff)
Reapply [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. Fixed since previous attempt: Don't check if the runtimes directory is the root of the CMake invocation; when the main LLVM CMake build builds runtimes, it does invoke a sub-CMake with this directory as the root too, just as if manually invoking CMake at the runtimes directory. Instead check whether LLVM_TOOLS_BINARY_DIR was set and whether find_package(LLVM) succeeded or not. Differential Revision: https://reviews.llvm.org/D107895
Diffstat (limited to 'runtimes')
-rw-r--r--runtimes/CMakeLists.txt11
1 files changed, 11 insertions, 0 deletions
diff --git a/runtimes/CMakeLists.txt b/runtimes/CMakeLists.txt
index 1ffce323d951..e926c3c30f49 100644
--- a/runtimes/CMakeLists.txt
+++ b/runtimes/CMakeLists.txt
@@ -58,6 +58,17 @@ if(compiler_rt_path)
endif()
endif()
+# If building standalone by pointing CMake at this runtimes directory,
+# LLVM_BINARY_DIR isn't set, find_package(LLVM) will fail and these
+# intermediate paths are unset.
+if (LLVM_BINARY_DIR STREQUAL "")
+ set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+endif()
+if (NOT LLVM_FOUND)
+ 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})