From 468258d641391015318bdd6ef0c8d06543acf6ee Mon Sep 17 00:00:00 2001 From: Ernest Borowski Date: Mon, 29 Jun 2020 22:46:00 -0700 Subject: [PATCH] cmake: Fix rapidJSON version detection --- CMakeLists.txt | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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)