1
0
mirror of https://github.com/moparisthebest/minetest synced 2024-12-23 08:08:47 -05:00
minetest/cmake/Modules/FindJson.cmake

28 lines
922 B
CMake
Raw Normal View History

# Look for JSONCPP if asked to.
# We use a bundled version by default because some distros ship versions of
# JSONCPP that cause segfaults and other memory errors when we link with them.
# See https://github.com/minetest/minetest/issues/1793
2013-02-21 17:00:44 -05:00
mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR)
option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause segfaults and other memory errors!" FALSE)
2013-02-21 17:00:44 -05:00
if(ENABLE_SYSTEM_JSONCPP)
find_library(JSON_LIBRARY NAMES jsoncpp)
find_path(JSON_INCLUDE_DIR json/features.h)
2013-02-21 17:00:44 -05:00
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JSONCPP DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
if(JSONCPP_FOUND)
message(STATUS "Using system JSONCPP library.")
endif()
endif()
if(NOT JSONCPP_FOUND)
message(STATUS "Using bundled JSONCPP library.")
set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json)
set(JSON_LIBRARY jsoncpp)
add_subdirectory(json)
endif()
2013-02-21 17:00:44 -05:00