[libclang] CMake: add an option to control building libclang as a static library (off by default)

This avoids building libclang twice by default.

llvm-svn: 183437
This commit is contained in:
Argyrios Kyrtzidis 2013-06-06 19:51:37 +00:00
parent 41a7b06888
commit f7b32a0bd0
1 changed files with 4 additions and 1 deletions

View File

@ -105,7 +105,10 @@ else()
set(LIBCLANG_STATIC_TARGET_NAME libclang)
endif()
if( NOT BUILD_SHARED_LIBS AND NOT WIN32 )
option(LIBCLANG_BUILD_STATIC
"Build libclang as a static library (in addition to a shared one)" OFF)
if( (NOT LLVM_ENABLE_PIC OR LIBCLANG_BUILD_STATIC) AND NOT WIN32 )
add_clang_library(${LIBCLANG_STATIC_TARGET_NAME} STATIC ${SOURCES})
target_link_libraries(${LIBCLANG_STATIC_TARGET_NAME} ${LIBRARIES})
add_dependencies(${LIBCLANG_STATIC_TARGET_NAME} ${GENERATED_HEADERS} clang-headers)