Skip to content

Commit 468258d

Browse files
xerrniMaskRay
authored andcommitted
cmake: Fix rapidJSON version detection
1 parent 6244594 commit 468258d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

CMakeLists.txt

+11-3
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,21 @@ set_property(SOURCE src/utils.cc APPEND PROPERTY COMPILE_DEFINITIONS
150150
### Includes
151151

152152
if(USE_SYSTEM_RAPIDJSON)
153-
find_package(RapidJSON QUIET)
153+
set(RapidJSON_MIN_VERSION "1.1.0")
154+
find_package(RapidJSON ${RapidJSON_MIN_VERSION} QUIET)
154155
if(NOT DEFINED RapidJSON_INCLUDE_DIRS AND DEFINED RAPIDJSON_INCLUDE_DIRS)
155-
message(FATAL_ERROR "RapidJSON version is likely too old. See https://github.com/MaskRay/ccls/issues/455")
156+
set(RapidJSON_INCLUDE_DIRS "${RAPIDJSON_INCLUDE_DIRS}")
156157
endif()
157158
endif()
158159
if(NOT RapidJSON_FOUND)
159-
set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include)
160+
if(EXISTS "${CMAKE_SOURCE_DIR}/third_party/rapidjson/include")
161+
message(STATUS "Using local RapidJSON")
162+
set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include)
163+
else()
164+
message(STATUS "Plase initialize rapidJSON git submodule as currently installed version is to old:")
165+
message(STATUS "git submodule init && git submodule update")
166+
message(FATAL_ERROR "RapidJSON version is likely too old. See https://github.com/MaskRay/ccls/issues/455")
167+
endif()
160168
endif()
161169

162170
target_include_directories(ccls PRIVATE src)

0 commit comments

Comments
 (0)