2021-03-05 16:11:55 +01:00
|
|
|
# Look for JsonCpp, with fallback to bundeled version
|
2013-02-21 23:00:44 +01:00
|
|
|
|
2015-02-28 00:05:29 +01:00
|
|
|
mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR)
|
2021-03-05 16:11:55 +01:00
|
|
|
option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JsonCpp" TRUE)
|
|
|
|
set(USE_SYSTEM_JSONCPP FALSE)
|
2013-02-21 23:00:44 +01:00
|
|
|
|
2015-02-28 00:05:29 +01:00
|
|
|
if(ENABLE_SYSTEM_JSONCPP)
|
|
|
|
find_library(JSON_LIBRARY NAMES jsoncpp)
|
2019-11-16 19:14:24 +01:00
|
|
|
find_path(JSON_INCLUDE_DIR json/allocator.h PATH_SUFFIXES jsoncpp)
|
2013-02-21 23:00:44 +01:00
|
|
|
|
2021-03-05 16:11:55 +01:00
|
|
|
if(JSON_LIBRARY AND JSON_INCLUDE_DIR)
|
|
|
|
message(STATUS "Using JsonCpp provided by system.")
|
|
|
|
set(USE_SYSTEM_JSONCPP TRUE)
|
2015-02-28 00:05:29 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-03-05 16:11:55 +01:00
|
|
|
if(NOT USE_SYSTEM_JSONCPP)
|
|
|
|
message(STATUS "Using bundled JsonCpp library.")
|
2017-04-07 23:56:02 +02:00
|
|
|
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp)
|
|
|
|
set(JSON_LIBRARY jsoncpp)
|
|
|
|
add_subdirectory(lib/jsoncpp)
|
2015-02-28 00:05:29 +01:00
|
|
|
endif()
|
2021-03-05 16:11:55 +01:00
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
|