From 9e0318d22916b9f813abfc962452e63a814a5ae7 Mon Sep 17 00:00:00 2001 From: Strahinja Val Markovic Date: Fri, 1 Mar 2013 18:03:28 -0800 Subject: [PATCH] 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. --- cpp/ycm/CMakeLists.txt | 63 ++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 39 deletions(-) diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 7c606af8..e37a2a59 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt @@ -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( 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 ) - # Figure out Clang version - if ( COMPILER_IS_CLANG ) - set( CLANG_VERSION ${CMAKE_CXX_COMPILER_VERSION} ) + message( "Downloading Clang 3.2" ) + + 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() - execute_process( COMMAND clang -dumpversion OUTPUT_VARIABLE CLANG_VERSION ) - endif() - - 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" ) + if ( 64_BIT_PLATFORM ) + set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" ) + set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" ) else() - if ( 64_BIT_PLATFORM ) - set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" ) - set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" ) - else() - set( CLANG_DIRNAME "clang+llvm-3.2-x86-linux-ubuntu-12.04" ) - set( CLANG_MD5 "cea2d01b3206e92a8df7b079935c070b" ) - endif() + set( CLANG_DIRNAME "clang+llvm-3.2-x86-linux-ubuntu-12.04" ) + set( CLANG_MD5 "cea2d01b3206e92a8df7b079935c070b" ) 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() + + 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() if ( PATH_TO_LLVM_ROOT OR USE_SYSTEM_LIBCLANG OR EXTERNAL_LIBCLANG_PATH )