-
Notifications
You must be signed in to change notification settings - Fork 130
/
Copy pathCMakeLists.txt
62 lines (56 loc) · 2.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Fetch depend code for ecosystem
# Here for header-only parts.
include(FetchContent)
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
# set DOWNLOAD_EXTRACT_TIMESTAMP ON cmake 3.24 or above
cmake_policy(SET CMP0135 NEW)
endif()
# Rapidjson
FetchContent_Declare(
rapidjson
GIT_REPOSITORY ${PHOTON_RAPIDJSON_GIT}
GIT_TAG v1.1.0
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/patches/rapidjson.patch
UPDATE_DISCONNECTED 1)
# Pre-set rapidjson build option, prevent building docs, examples and tests
set(RAPIDJSON_BUILD_DOC OFF CACHE BOOL "Build rapidjson documentation.")
set(RAPIDJSON_BUILD_EXAMPLES OFF CACHE BOOL "Build rapidjson documentation.")
set(RAPIDJSON_BUILD_TESTS OFF CACHE BOOL "Build rapidjson perftests and unittests.")
FetchContent_MakeAvailable(rapidjson)
message(STATUS "Rapidjson source dir: ${rapidjson_SOURCE_DIR}")
# RapidXml
FetchContent_Declare(
rapidxml
URL ${PHOTON_RAPIDXML_SOURCE}
URL_HASH
SHA256=c3f0b886374981bb20fabcf323d755db4be6dba42064599481da64a85f5b3571
UPDATE_DISCONNECTED 1)
FetchContent_MakeAvailable(rapidxml)
message(STATUS "Rapidxml source dir: ${rapidxml_SOURCE_DIR}")
# RapidYAML
# Single header file so should set DOWNLOAD_NO_EXTRACT
FetchContent_Declare(
rapidyaml
URL ${PHOTON_RAPIDYAML_SOURCE}
URL_HASH
SHA256=09a5be64f7add04e24a675704a16b3aea7ed80e9ff73d865a3b92301971d0815
DOWNLOAD_NO_EXTRACT 1
UPDATE_DISCONNECTED 1)
FetchContent_MakeAvailable(rapidyaml)
if (CMAKE_VERSION VERSION_LESS "3.18.0")
# Before 3.18, CMake will not copy single header file to src directory
file(COPY
${FETCHCONTENT_BASE_DIR}/rapidyaml-subbuild/rapidyaml-populate-prefix/src/rapidyaml-0.5.0.hpp
DESTINATION ${rapidyaml_SOURCE_DIR})
endif()
message(STATUS "Rapidyaml source dir: ${rapidyaml_SOURCE_DIR}")
add_library(ecosystem_deps INTERFACE)
target_include_directories(
ecosystem_deps
INTERFACE ${rapidjson_SOURCE_DIR}/include ${rapidxml_SOURCE_DIR} ${rapidyaml_SOURCE_DIR}
)
get_property(
incs
TARGET ecosystem_deps
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "ecosystem_deps incs: ${incs}")