-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathcJSON.cmake
More file actions
47 lines (40 loc) · 1.62 KB
/
Copy pathcJSON.cmake
File metadata and controls
47 lines (40 loc) · 1.62 KB
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
# Copyright 2020 Benbuck Nason
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
include(FetchContent)
find_package(Patch REQUIRED)
set(CJSON_BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(CJSON_OVERRIDE_BUILD_SHARED_LIBS ON CACHE BOOL "" FORCE)
set(ENABLE_CJSON_TEST OFF CACHE BOOL "" FORCE)
set(ENABLE_CJSON_UNINSTALL OFF CACHE BOOL "" FORCE)
set(ENABLE_CJSON_UTILS OFF CACHE BOOL "" FORCE)
set(ENABLE_CJSON_VERSION_SO OFF CACHE BOOL "" FORCE)
set(ENABLE_TARGET_EXPORT OFF CACHE BOOL "" FORCE)
FetchContent_Declare(
cJSON
GIT_REPOSITORY https://github.com/DaveGamble/cJSON.git
GIT_TAG v1.7.18
PATCH_COMMAND "${Patch_EXECUTABLE}" -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/cJSON.patch
UPDATE_DISCONNECTED 1
EXCLUDE_FROM_ALL
)
FetchContent_MakeAvailable(cJSON)
target_include_directories(cjson INTERFACE ${cJSON_SOURCE_DIR})
# could potentially be removed if cJSON fixes all warnings
# see https://github.com/DaveGamble/cJSON/issues/894 for one such issue
target_compile_options(cjson
PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W0> # disable warnings
$<$<CXX_COMPILER_ID:Clang>:-w> # disable warnings
)
add_library(cJSON ALIAS cjson)