Build option to use system libclang

This commit is contained in:
Strahinja Val Markovic 2012-08-04 18:49:21 -07:00
parent d0f62d1205
commit f3ddfd5458
2 changed files with 16 additions and 4 deletions

View File

@ -24,7 +24,12 @@ project( YouCompleteMe )
# On Mac, boost needs to be compiled universal as well, if used instead of the
# included BoostParts lib. For brew, that's
# "brew install boost --universal"
set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
# If the user chose to use the system libclang.dylib on a mac, then we don't
# specify universal binary building since the system libclang on macs is not
# universal (and thus linking would fail with universal).
if ( NOT USE_SYSTEM_LIBCLANG )
set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
endif()
if ( CMAKE_CXX_COMPILER_ID STREQUAL "Clang" )
set( COMPILER_IS_CLANG true )

View File

@ -50,18 +50,25 @@ endif()
#############################################################################
# One can set an external libclang.so for use with this flag; something like
# One can use the system libclang.[so|dylib] like so:
# cmake -DUSE_SYSTEM_LIBCLANG=1 [...]
# One can also explicitely pick the external libclang.[so|dylib] for use like so:
# cmake -DEXTERNAL_LIBCLANG_PATH=/path/to/libclang.so [...]
# The final .so we build will then first look in the same dir in which it is
# located for libclang.so. This is provided by the rpath = $ORIGIN feature.
# Using an external libclang is an UNDOCUMENTED and UNSUPPORTED feature! I don't
# want to hear a single bug report about it! :) (I mean it)
if ( EXTERNAL_LIBCLANG_PATH )
if ( EXTERNAL_LIBCLANG_PATH OR USE_SYSTEM_LIBCLANG )
# Setting this to true makes sure that libraries we build will have our rpath
# set even without having to do "make install"
set( CMAKE_BUILD_WITH_INSTALL_RPATH TRUE )
set( CMAKE_INSTALL_RPATH "\$ORIGIN" )
if ( USE_SYSTEM_LIBCLANG )
find_library( EXTERNAL_LIBCLANG_PATH clang )
endif()
set( LIBCLANG_TARGET ${EXTERNAL_LIBCLANG_PATH} )
message(
"Using external libclang: ${EXTERNAL_LIBCLANG_PATH}" )