Let rapidjson as a module in cmake
This commit is contained in:
parent
be11ab7a3d
commit
5ffb280aad
|
@ -73,6 +73,7 @@ if(NOT WIN32)
|
|||
test/mako/utils.h)
|
||||
add_subdirectory(test/unit/third_party)
|
||||
find_package(Threads REQUIRED)
|
||||
include(Compilerapidjson)
|
||||
set(UNIT_TEST_SRCS
|
||||
test/unit/unit_tests.cpp
|
||||
test/unit/fdb_api.cpp
|
||||
|
|
|
@ -16,19 +16,3 @@ ExternalProject_Add(
|
|||
|
||||
ExternalProject_Get_Property(doctest source_dir)
|
||||
set(DOCTEST_INCLUDE_DIR ${source_dir}/doctest CACHE INTERNAL "Path to include folder for doctest")
|
||||
|
||||
# Download rapidjson repo.
|
||||
ExternalProject_Add(
|
||||
rapidjson
|
||||
PREFIX ${CMAKE_BINARY_DIR}/rapidjson
|
||||
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
|
||||
GIT_TAG f54b0e47a08782a6131cc3d60f94d038fa6e0a51 # v1.1.0
|
||||
TIMEOUT 10
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property(rapidjson source_dir)
|
||||
set(RAPIDJSON_INCLUDE_DIR ${source_dir}/include CACHE INTERNAL "Path to include folder for rapidjson")
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
# Findrapidjson
|
||||
|
||||
find_package(rapidjson)
|
||||
|
||||
include(ExternalProject)
|
||||
|
||||
if (rapidjson_FOUND)
|
||||
message(STATUS "Found rapidjson library!")
|
||||
ExternalProject_Add(rapidjson
|
||||
PREFIX ${CMAKE_BINARY_DIR}/rapidjson
|
||||
DOWNLOAD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
)
|
||||
else()
|
||||
message(STATUS "rapidjson not found. Downloading ...")
|
||||
ExternalProject_Add(
|
||||
rapidjson
|
||||
PREFIX ${CMAKE_BINARY_DIR}/rapidjson
|
||||
GIT_REPOSITORY https://github.com/Tencent/rapidjson.git
|
||||
GIT_TAG f54b0e47a08782a6131cc3d60f94d038fa6e0a51 # v1.1.0
|
||||
TIMEOUT 10s
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ""
|
||||
LOG_DOWNLOAD ON
|
||||
)
|
||||
|
||||
ExternalProject_Get_Property(rapidjson SOURCE_DIR)
|
||||
set (RAPIDJSON_INCLUDE_DIR "${SOURCE_DIR}/include")
|
||||
|
||||
# set(rapidjson_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
message(STATUS "Found rapidjson includes: ${RAPIDJSON_INCLUDE_DIR}")
|
||||
|
||||
mark_as_advanced(
|
||||
RAPIDJSON_INCLUDE_DIR
|
||||
)
|
|
@ -0,0 +1,8 @@
|
|||
# Findrapidjson
|
||||
|
||||
find_path(RAPIDJSON_INCLUDE_DIR
|
||||
NAMES rapidjson/rapidjson.h
|
||||
PATH_SUFFIXES include)
|
||||
|
||||
find_package_handle_standard_args(rapidjson
|
||||
DEFAULT_MSG RAPIDJSON_INCLUDE_DIR)
|
Loading…
Reference in New Issue