Skip to content

Commit ac3ff26

Browse files
committed
[CMake] Parameterize MODULE and SHARED in add_clang_library().
llvm-svn: 199902
1 parent 5383113 commit ac3ff26

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

clang/CMakeLists.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ function(clang_tablegen)
275275
endfunction(clang_tablegen)
276276

277277
macro(add_clang_library name)
278-
llvm_process_sources(srcs ${ARGN})
278+
cmake_parse_arguments(ARG "MODULE;SHARED;STATIC" "" "" ${ARGN})
279+
llvm_process_sources(srcs ${ARG_UNPARSED_ARGUMENTS})
279280
if(MSVC_IDE OR XCODE)
280281
# Add public headers
281282
file(RELATIVE_PATH lib_path
@@ -298,9 +299,9 @@ macro(add_clang_library name)
298299
set(srcs ${srcs} ${headers} ${tds})
299300
endif()
300301
endif(MSVC_IDE OR XCODE)
301-
if (MODULE)
302+
if (ARG_MODULE)
302303
set(libkind MODULE)
303-
elseif (SHARED_LIBRARY)
304+
elseif (ARG_SHARED)
304305
set(libkind SHARED)
305306
else()
306307
set(libkind)
@@ -316,7 +317,7 @@ macro(add_clang_library name)
316317
target_link_libraries( ${name} ${LLVM_COMMON_LIBS} )
317318
link_system_libs( ${name} )
318319

319-
if ((SHARED_LIBRARY OR MODULE) AND LLVM_EXPORTED_SYMBOL_FILE)
320+
if ((ARG_SHARED OR ARG_MODULE) AND LLVM_EXPORTED_SYMBOL_FILE)
320321
add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
321322
endif()
322323

clang/examples/PrintFunctionNames/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
set(MODULE TRUE)
2-
31
set( LLVM_LINK_COMPONENTS
42
Support
53
)
@@ -15,7 +13,7 @@ if( NOT WIN32 ) # Win32 mangles symbols differently, and
1513
endif()
1614
endif()
1715

18-
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
16+
add_clang_library(PrintFunctionNames MODULE PrintFunctionNames.cpp)
1917

2018
add_dependencies(PrintFunctionNames
2119
ClangAttrClasses

clang/examples/analyzer-plugin/CMakeLists.txt

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
set(MODULE TRUE)
2-
31
set(LLVM_LINK_COMPONENTS
42
Support
53
)
64

7-
add_clang_library(SampleAnalyzerPlugin MainCallChecker.cpp)
5+
add_clang_library(SampleAnalyzerPlugin MODULE MainCallChecker.cpp)
86

97
add_dependencies(SampleAnalyzerPlugin
108
ClangAttrClasses

clang/tools/libclang/CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ if(MSVC)
7373
endif()
7474

7575
if( LLVM_ENABLE_PIC )
76-
set(SHARED_LIBRARY TRUE)
77-
add_clang_library(libclang ${SOURCES})
76+
add_clang_library(libclang SHARED ${SOURCES})
7877
target_link_libraries(libclang ${LIBRARIES})
7978
add_dependencies(libclang ${GENERATED_HEADERS} clang-headers)
8079

0 commit comments

Comments
 (0)