Not using the system libclang by default

We used to do this but it was unsafe, as issue #167 proves. YCM has to give
libclang an include to YCM's copy of clang system headers (again, see issue #167
for details) and those headers may not be valid for a newer libclang.

If the user really wants to user the system libclang, then he can just always
call cmake himself. The installation guide in the README goes to great lengths
to explain the simple process of building YCM "by hand".

Fixes #167.
This commit is contained in:
Strahinja Val Markovic 2013-03-01 18:03:28 -08:00
parent 67bf88b726
commit 9e0318d229

View File

@ -33,50 +33,35 @@ option( PATH_TO_LLVM_ROOT "Path to the root of a LLVM+Clang binary distribution"
option( USE_SYSTEM_LIBCLANG "Set to ON to use the system libclang library" OFF ) option( USE_SYSTEM_LIBCLANG "Set to ON to use the system libclang library" OFF )
option( EXTERNAL_LIBCLANG_PATH "Path libclang library to use" ) option( EXTERNAL_LIBCLANG_PATH "Path libclang library to use" )
# Checks for clang 3.2 (LLVM 4.2+)
if ( USE_CLANG_COMPLETER AND NOT USE_SYSTEM_LIBCLANG AND NOT PATH_TO_LLVM_ROOT ) if ( USE_CLANG_COMPLETER AND NOT USE_SYSTEM_LIBCLANG AND NOT PATH_TO_LLVM_ROOT )
# Figure out Clang version message( "Downloading Clang 3.2" )
if ( COMPILER_IS_CLANG )
set( CLANG_VERSION ${CMAKE_CXX_COMPILER_VERSION} ) set( CLANG_URL "http://llvm.org/releases/3.2" )
if ( APPLE )
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-apple-darwin11" )
set( CLANG_MD5 "fbdca3b4e8cdaa2352f2aeb038a16532" )
else() else()
execute_process( COMMAND clang -dumpversion OUTPUT_VARIABLE CLANG_VERSION ) if ( 64_BIT_PLATFORM )
endif() set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" )
set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" )
if ( CLANG_VERSION VERSION_EQUAL 4.2 OR CLANG_VERSION VERSION_GREATER 4.2 )
# Good enough, use it.
set( USE_SYSTEM_LIBCLANG ON )
message( "System libclang seems good enough, using it." )
else()
# If the wrong version, or not found, download
message( "Downloading Clang 3.2 (system libclang not present or not good enough)" )
set( CLANG_URL "http://llvm.org/releases/3.2" )
if ( APPLE )
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-apple-darwin11" )
set( CLANG_MD5 "fbdca3b4e8cdaa2352f2aeb038a16532" )
else() else()
if ( 64_BIT_PLATFORM ) set( CLANG_DIRNAME "clang+llvm-3.2-x86-linux-ubuntu-12.04" )
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" ) set( CLANG_MD5 "cea2d01b3206e92a8df7b079935c070b" )
set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" )
else()
set( CLANG_DIRNAME "clang+llvm-3.2-x86-linux-ubuntu-12.04" )
set( CLANG_MD5 "cea2d01b3206e92a8df7b079935c070b" )
endif()
endif() endif()
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.gz" )
file(
DOWNLOAD "${CLANG_URL}/${CLANG_FILENAME}" "./${CLANG_FILENAME}"
SHOW_PROGRESS EXPECTED_MD5 "${CLANG_MD5}"
)
execute_process( COMMAND tar -xzf ${CLANG_FILENAME} )
# And set PATH_TO_LLVM_ROOT
set( PATH_TO_LLVM_ROOT "${CMAKE_CURRENT_BINARY_DIR}/../${CLANG_DIRNAME}" )
endif() endif()
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.gz" )
file(
DOWNLOAD "${CLANG_URL}/${CLANG_FILENAME}" "./${CLANG_FILENAME}"
SHOW_PROGRESS EXPECTED_MD5 "${CLANG_MD5}"
)
execute_process( COMMAND tar -xzf ${CLANG_FILENAME} )
# And set PATH_TO_LLVM_ROOT
set( PATH_TO_LLVM_ROOT "${CMAKE_CURRENT_BINARY_DIR}/../${CLANG_DIRNAME}" )
endif() endif()
if ( PATH_TO_LLVM_ROOT OR USE_SYSTEM_LIBCLANG OR EXTERNAL_LIBCLANG_PATH ) if ( PATH_TO_LLVM_ROOT OR USE_SYSTEM_LIBCLANG OR EXTERNAL_LIBCLANG_PATH )