Skip to content

Commit dbc2a12

Browse files
committed
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. llvm-svn: 361271
1 parent 4b82e50 commit dbc2a12

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

clang/cmake/modules/AddClang.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ macro(add_clang_library name)
8383
if(ARG_SHARED)
8484
set(LIBTYPE SHARED)
8585
else()
86-
set(LIBTYPE STATIC OBJECT)
86+
# llvm_add_library ignores BUILD_SHARED_LIBS if STATIC is explicitly set,
87+
# so we need to handle it here.
88+
if(BUILD_SHARED_LIBS)
89+
set(LIBTYPE SHARED OBJECT)
90+
else()
91+
set(LIBTYPE STATIC OBJECT)
92+
endif()
8793
set_property(GLOBAL APPEND PROPERTY CLANG_STATIC_LIBS ${name})
8894
endif()
8995
llvm_add_library(${name} ${LIBTYPE} ${ARG_UNPARSED_ARGUMENTS} ${srcs})

0 commit comments

Comments
 (0)