Skip to content

Commit 62cbf58

Browse files
committed
cmake: add option to use system rapidjson if exists
1 parent 5e15f51 commit 62cbf58

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ include(DefaultCMakeBuildType)
77
# Required Clang version
88
option(LLVM_ENABLE_RTTI "-fno-rtti if OFF. This should match LLVM libraries" OFF)
99
option(USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF)
10+
option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git submodule if exists" ON)
1011

1112
# Sources for the executable are specified at end of CMakeLists.txt
1213
add_executable(ccls "")
@@ -96,8 +97,16 @@ target_compile_definitions(ccls PRIVATE
9697

9798
target_include_directories(ccls PRIVATE src)
9899
target_include_directories(ccls SYSTEM PRIVATE
99-
third_party
100-
third_party/rapidjson/include)
100+
third_party)
101+
102+
if(USE_SYSTEM_RAPIDJSON)
103+
find_package(RapidJSON QUIET)
104+
endif()
105+
if(RapidJSON_FOUND)
106+
target_include_directories(ccls SYSTEM PRIVATE ${RapidJSON_INCLUDE_DIRS})
107+
else()
108+
target_include_directories(ccls SYSTEM PRIVATE third_party/rapidjson/include)
109+
endif()
101110

102111
### Install
103112

0 commit comments

Comments
 (0)