diff --git a/cpp/ycm/CMakeLists.txt b/cpp/ycm/CMakeLists.txt index 0f6a49d8..754e0a17 100644 --- a/cpp/ycm/CMakeLists.txt +++ b/cpp/ycm/CMakeLists.txt @@ -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" "$" - ) + ) endif() diff --git a/cpp/ycm/tests/CMakeLists.txt b/cpp/ycm/tests/CMakeLists.txt index a3abaa5d..4db1ce46 100644 --- a/cpp/ycm/tests/CMakeLists.txt +++ b/cpp/ycm/tests/CMakeLists.txt @@ -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} ) diff --git a/cpp/ycm/tests/ClangCompleter_test.cpp b/cpp/ycm/tests/ClangCompleter/ClangCompleter_test.cpp similarity index 100% rename from cpp/ycm/tests/ClangCompleter_test.cpp rename to cpp/ycm/tests/ClangCompleter/ClangCompleter_test.cpp diff --git a/cpp/ycm/tests/TranslationUnit_test.cpp b/cpp/ycm/tests/ClangCompleter/TranslationUnit_test.cpp similarity index 100% rename from cpp/ycm/tests/TranslationUnit_test.cpp rename to cpp/ycm/tests/ClangCompleter/TranslationUnit_test.cpp