Respects USE_CLANG_COMPLETER flag in CMake build
If USE_CLANG_COMPLETER is ON, will try to use the system clang, and if the version is not the minimum required or not present, download.
This commit is contained in:
parent
3b4eeee686
commit
2f3303e050
@ -34,34 +34,34 @@ 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+)
|
# Checks for clang 3.2 (LLVM 4.2+)
|
||||||
if ( 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 )
|
||||||
# Are we using it?
|
# Figure out Clang version
|
||||||
if ( COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.1 )
|
if ( COMPILER_IS_CLANG )
|
||||||
set( USE_SYSTEM_LIBCLANG ON )
|
set( CLANG_VERSION ${CMAKE_CXX_COMPILER_VERSION} )
|
||||||
else()
|
else()
|
||||||
# If not using it, is it in the system and the right version?
|
|
||||||
execute_process( COMMAND clang -dumpversion OUTPUT_VARIABLE CLANG_VERSION )
|
execute_process( COMMAND clang -dumpversion OUTPUT_VARIABLE CLANG_VERSION )
|
||||||
if ( CLANG_VERSION VERSION_GREATER 4.1 )
|
endif()
|
||||||
set( USE_SYSTEM_LIBCLANG ON )
|
if ( CLANG_VERSION VERSION_EQUAL 4.2 OR CLANG_VERSION VERSION_GREATER 4.2 )
|
||||||
else() # If the wrong version, or not found, download
|
# Good enough, use it.
|
||||||
message( "Downloading Clang 3.2" )
|
set( USE_SYSTEM_LIBCLANG ON )
|
||||||
set( CLANG_URL "http://llvm.org/releases/3.2" )
|
else() # If the wrong version, or not found, download
|
||||||
if ( APPLE )
|
message( "Downloading Clang 3.2" )
|
||||||
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-apple-darwin11" )
|
set( CLANG_URL "http://llvm.org/releases/3.2" )
|
||||||
set( CLANG_MD5 "fbdca3b4e8cdaa2352f2aeb038a16532" )
|
if ( APPLE )
|
||||||
else()
|
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-apple-darwin11" )
|
||||||
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" )
|
set( CLANG_MD5 "fbdca3b4e8cdaa2352f2aeb038a16532" )
|
||||||
set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" )
|
else()
|
||||||
endif()
|
set( CLANG_DIRNAME "clang+llvm-3.2-x86_64-linux-ubuntu-12.04" )
|
||||||
set( CLANG_FILENAME "${CLANG_DIRNAME}.tar.gz" )
|
set( CLANG_MD5 "81821e339d7300afb76aca8edab2cf4f" )
|
||||||
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()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user