r361271 - Fix BUILD_SHARED_LIBS for clang which broke in D61909

Chris Bieneman via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 08:56:17 PDT 2019


Author: cbieneman
Date: Tue May 21 08:56:17 2019
New Revision: 361271

URL: http://llvm.org/viewvc/llvm-project?rev=361271&view=rev
Log:
Fix BUILD_SHARED_LIBS for clang which broke in D61909

llvm_add_library ignores `BUILD_SHARED_LIBS` `STATIC` is explicitly specified. This restores the `BUILD_SHARED_LIBS` behavior to the clang build.

Modified:
    cfe/trunk/cmake/modules/AddClang.cmake

Modified: cfe/trunk/cmake/modules/AddClang.cmake
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/cmake/modules/AddClang.cmake?rev=361271&r1=361270&r2=361271&view=diff
==============================================================================
--- cfe/trunk/cmake/modules/AddClang.cmake (original)
+++ cfe/trunk/cmake/modules/AddClang.cmake Tue May 21 08:56:17 2019
@@ -83,7 +83,13 @@ macro(add_clang_library name)
   if(ARG_SHARED)
     set(LIBTYPE SHARED)
   else()
-    set(LIBTYPE STATIC OBJECT)
+    # llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
+    # so we need to handle it here.
+    if(BUILD_SHARED_LIBS)
+      set(LIBTYPE SHARED OBJECT)
+    else()
+      set(LIBTYPE STATIC OBJECT)
+    endif()
     set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
   endif()
   llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})




More information about the cfe-commits mailing list