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

Aiden Grossman via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Jun 5 13:00:50 PDT 2023


aidengrossman created this revision.
Herald added subscribers: libc-commits, ekilmer, tschuett.
Herald added projects: libc-project, All.
aidengrossman requested review of this revision.

ea8f4b98419750c8cc7c60ea43b570adf47b3f78 <https://reviews.llvm.org/rGea8f4b98419750c8cc7c60ea43b570adf47b3f78> 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152190

Files:
  libc/CMakeLists.txt


Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -17,10 +17,14 @@
 # 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})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152190.528551.patch
Type: text/x-patch
Size: 906 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230605/df759e92/attachment-0001.bin>


More information about the libc-commits mailing list