Skip to content

Commit

Permalink
cmake: add option to use system rapidjson if exists
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Mar 9, 2019
1 parent 9ca095f commit 478f849
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ include(DefaultCMakeBuildType)
# Required Clang version
option(LLVM_ENABLE_RTTI "-fno-rtti if OFF. This should match LLVM libraries" OFF)
option(USE_SHARED_LLVM "Link against libLLVM.so instead separate LLVM{Option,Support,...}" OFF)
option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git submodule if exists" ON)

# Sources for the executable are specified at end of CMakeLists.txt
add_executable(ccls "")
Expand Down Expand Up @@ -95,9 +96,15 @@ target_compile_definitions(ccls PRIVATE
### Includes

target_include_directories(ccls PRIVATE src)
target_include_directories(ccls SYSTEM PRIVATE
third_party
third_party/rapidjson/include)
target_include_directories(ccls SYSTEM PRIVATE third_party)

if(USE_SYSTEM_RAPIDJSON)
find_package(RapidJSON QUIET)
endif()
if(NOT RapidJSON_FOUND)
set(RapidJSON_INCLUDE_DIRS third_party/rapidjson/include)
endif()
target_include_directories(ccls SYSTEM PRIVATE ${RapidJSON_INCLUDE_DIRS})

### Install

Expand Down

0 comments on commit 478f849

Please sign in to comment.