[PATCH] D69440: [cmake] Add support for explicit STATIC libraries even when building mostly shared libraries.

Stephen Neuendorffer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 25 11:21:29 PDT 2019


stephenneuendorffer created this revision.
stephenneuendorffer added a reviewer: chandlerc.
Herald added subscribers: llvm-commits, mgorny.
Herald added a project: LLVM.

By default when BUILD_SHARED_LIBS=ON, all libraries are forced to be
shared.  However, with circular dependencies between libraries this
becomes a problem.  This change allows libraries to be explicitly
marked as static in CMAKE to solve circular dependencies while getting
most of the build-time advantages from BUILD_SHARED_LIBS=ON


Repository:
  rL LLVM

https://reviews.llvm.org/D69440

Files:
  llvm/cmake/modules/AddLLVM.cmake


Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -671,12 +671,14 @@
 
 macro(add_llvm_library name)
   cmake_parse_arguments(ARG
-    "SHARED;BUILDTREE_ONLY;MODULE;INSTALL_WITH_TOOLCHAIN"
+    "SHARED;STATIC;BUILDTREE_ONLY;MODULE;INSTALL_WITH_TOOLCHAIN"
     ""
     ""
     ${ARGN})
   if(ARG_MODULE)
     llvm_add_library(${name} MODULE ${ARG_UNPARSED_ARGUMENTS})
+  elseif(ARG_STATIC)
+    llvm_add_library(${name} STATIC ${ARG_UNPARSED_ARGUMENTS})
   elseif( BUILD_SHARED_LIBS OR ARG_SHARED )
     llvm_add_library(${name} SHARED ${ARG_UNPARSED_ARGUMENTS})
   else()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69440.226469.patch
Type: text/x-patch
Size: 707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191025/cd31fbda/attachment.bin>


More information about the llvm-commits mailing list