Files
itgmania212121/extern/CMakeProject-json.cmake
T
Martin Natano e1b5664f21 Update jsoncpp from version 0.5.0 to 1.9.5
Aside from including a ton of bug fixes, this should fix an issue in the
CI pipeline when building with system libraries that was caused by a
minor incompatibility between 0.5.0 and less ancient versions.

Also, switch to the amalgamated source, because it makes it easier to
keep it up to date.
https://github.com/open-source-parsers/jsoncpp/wiki/Amalgamated-(Possibly-outdated)
2022-02-19 14:10:55 +01:00

31 lines
979 B
CMake

if(WITH_SYSTEM_JSONCPP)
find_package(PkgConfig REQUIRED)
pkg_check_modules(JSONCPP REQUIRED jsoncpp)
else()
list(APPEND JSON_SRC "jsoncpp/jsoncpp.cpp")
list(APPEND JSON_HPP
"jsoncpp/json/json-forwards.h"
"jsoncpp/json/json.h")
source_group("" FILES ${JSON_SRC} ${JSON_HPP})
add_library("jsoncpp" STATIC ${JSON_SRC} ${JSON_HPP})
set_property(TARGET "jsoncpp" PROPERTY FOLDER "External Libraries")
set_property(TARGET "jsoncpp" PROPERTY CXX_STANDARD 11)
set_property(TARGET "jsoncpp" PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET "jsoncpp" PROPERTY CXX_EXTENSIONS OFF)
disable_project_warnings("jsoncpp")
target_include_directories("jsoncpp" PUBLIC "jsoncpp")
if(MSVC)
sm_add_compile_definition("jsoncpp" _CRT_SECURE_NO_WARNINGS)
elseif(APPLE)
set_target_properties("jsoncpp" PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY "libc++")
sm_add_compile_flag("jsoncpp" "-stdlib=libc++")
endif()
endif()