ClangCompleter tests not built when no libclang

When the user doesn't want semantic completion with clang, then tests that test
those features are not included in the test binary.
This commit is contained in:
Strahinja Val Markovic 2013-01-13 17:33:35 -08:00
parent 3763dc8a78
commit cc53a46f54
4 changed files with 17 additions and 3 deletions

View File

@ -26,8 +26,14 @@ 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" )
if ( NOT PATH_TO_LLVM_ROOT AND NOT USE_SYSTEM_LIBCLANG AND NOT
EXTERNAL_LIBCLANG_PATH )
if ( PATH_TO_LLVM_ROOT OR USE_SYSTEM_LIBCLANG OR EXTERNAL_LIBCLANG_PATH )
set( USE_CLANG_COMPLETER TRUE )
endif()
if ( USE_CLANG_COMPLETER AND
NOT PATH_TO_LLVM_ROOT AND
NOT USE_SYSTEM_LIBCLANG AND
NOT EXTERNAL_LIBCLANG_PATH )
message( FATAL_ERROR
"You have not specified which libclang to use. You have several options:\n"
" 1. Set PATH_TO_LLVM_ROOT to a path to the root of a LLVM+Clang binary "
@ -168,7 +174,7 @@ if ( EXTERNAL_LIBCLANG_PATH AND APPLE )
"@rpath/libclang.dylib"
"@loader_path/libclang.dylib"
"$<TARGET_FILE:${PROJECT_NAME}>"
)
)
endif()

View File

@ -45,6 +45,14 @@ link_directories(
file( GLOB SOURCES *.h *.cpp )
if ( NOT USE_CLANG_COMPLETER )
file( GLOB_RECURSE to_remove_clang ClangCompleter/*.h ClangCompleter/*.cpp )
if( to_remove_clang )
list( REMOVE_ITEM SOURCES ${to_remove_clang} )
endif()
endif()
add_executable( ${PROJECT_NAME}
${SOURCES}
)