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

Aiden Grossman via libc-commits libc-commits at lists.llvm.org
Mon Jun 5 17:44:42 PDT 2023


Author: Aiden Grossman
Date: 2023-06-06T00:43:11Z
New Revision: 14a06b806e3c2b4166e657fe25511bed0fcaf1c3

URL: https://github.com/llvm/llvm-project/commit/14a06b806e3c2b4166e657fe25511bed0fcaf1c3
DIFF: https://github.com/llvm/llvm-project/commit/14a06b806e3c2b4166e657fe25511bed0fcaf1c3.diff

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

ea8f4b98419750c8cc7c60ea43b570adf47b3f78 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

Added: 
    

Modified: 
    libc/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt
index aa09a5182469b..b84467c93faa7 100644
--- a/libc/CMakeLists.txt
+++ b/libc/CMakeLists.txt
@@ -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})


        


More information about the libc-commits mailing list