[CMake][libc] Don't put archive in build/lib/<target triple> by default

ea8f4b9841 broke some build configurations
because it was enabled by default and some people are using a just built
libc/clang/LLVM to work on other projects where having a just built LLVM
libc in one of Clang's default include directories can make things
unusable.

Differential Revision: https://reviews.llvm.org/D152190
This commit is contained in:
Aiden Grossman 2023-06-05 19:57:13 +00:00
parent e6a350df10
commit 14a06b806e

View File

@ -17,10 +17,14 @@ set(LIBC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
# The top-level directory in which libc is being built.
set(LIBC_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR})
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR)
set(LIBC_ENABLE_USE_BY_CLANG OFF CACHE BOOL "Whether or not to place libc in a build directory findable by a just built clang")
if(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND LIBC_ENABLE_USE_BY_CLANG)
set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}/${LLVM_DEFAULT_TARGET_TRIPLE})
else()
if(LLVM_LIBRARY_OUTPUT_INTDIR)
if(NOT LIBC_ENABLE_USE_BY_CLANG)
set(LIBC_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
elseif(LLVM_LIBRARY_OUTPUT_INTDIR)
set(LIBC_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
else()
set(LIBC_LIBRARY_DIR ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX})