diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ffe0e68..a94d9c91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -150,13 +150,21 @@ set_property(SOURCE src/utils.cc APPEND PROPERTY COMPILE_DEFINITIONS ### Includes if(USE_SYSTEM_RAPIDJSON) - find_package(RapidJSON QUIET) + set(RapidJSON_MIN_VERSION "1.1.0") + find_package(RapidJSON ${RapidJSON_MIN_VERSION} QUIET) if(NOT DEFINED RapidJSON_INCLUDE_DIRS AND DEFINED RAPIDJSON_INCLUDE_DIRS) - message(FATAL_ERROR "RapidJSON version is likely too old. See https://github.com/MaskRay/ccls/issues/455") + set(RapidJSON_INCLUDE_DIRS "${RAPIDJSON_INCLUDE_DIRS}") endif() endif() if(NOT RapidJSON_FOUND) - set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include) + if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/rapidjson/include") + message(STATUS "Using local RapidJSON") + set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include) + else() + message(STATUS "Plase initialize rapidJSON git submodule as currently installed version is to old:") + message(STATUS "git submodule init && git submodule update") + message(FATAL_ERROR "RapidJSON version is likely too old. See https://github.com/MaskRay/ccls/issues/455") + endif() endif() target_include_directories(ccls PRIVATE src)