[PATCH] D67585: [clang] [cmake] Make building dylib optional

Michał Górny via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 14 03:41:32 PDT 2019


mgorny created this revision.
mgorny added reviewers: tstellar, sylvestre.ledru, smeenai, beanz.

Similarly to how LLVM dylib can be disabled via LLVM_BUILD_LLVM_DYLIB,
introduce CLANG_BUILD_CLANG_DYLIB to make it possible to disable
building clang's dylib.  This is useful for pure testing environments
where linking huge libraries can take a lot of memory/time.


https://reviews.llvm.org/D67585

Files:
  clang/CMakeLists.txt
  clang/tools/clang-shlib/CMakeLists.txt


Index: clang/tools/clang-shlib/CMakeLists.txt
===================================================================
--- clang/tools/clang-shlib/CMakeLists.txt
+++ clang/tools/clang-shlib/CMakeLists.txt
@@ -1,5 +1,5 @@
 # Building libclang-cpp.so fails if LLVM_ENABLE_PIC=Off
-if (NOT LLVM_ENABLE_PIC)
+if (NOT LLVM_ENABLE_PIC OR NOT CLANG_BUILD_CLANG_DYLIB)
   return()
 endif()
 
Index: clang/CMakeLists.txt
===================================================================
--- clang/CMakeLists.txt
+++ clang/CMakeLists.txt
@@ -322,6 +322,8 @@
 set(CLANG_PYTHON_BINDINGS_VERSIONS "" CACHE STRING
     "Python versions to install libclang python bindings for")
 
+set(CLANG_BUILD_CLANG_DYLIB ON CACHE BOOL
+    "Build libclang-cpp.so dynamic library")
 set(CLANG_LINK_CLANG_DYLIB ${LLVM_LINK_LLVM_DYLIB} CACHE BOOL
     "Link tools against libclang-cpp.so")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67585.220210.patch
Type: text/x-patch
Size: 860 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190914/16c3a37c/attachment.bin>


More information about the cfe-commits mailing list