diff options
author | sfan5 <sfan5@live.de> | 2021-03-05 16:11:55 +0100 |
---|---|---|
committer | sfan5 <sfan5@live.de> | 2021-03-07 14:26:09 +0100 |
commit | dcb30a593dafed89ef52e712533b0706bddbd36e (patch) | |
tree | 596e873bcbf5caa765f142908e96456b3e824797 /cmake/Modules/FindJson.cmake | |
parent | 593d5f4465f5f181b87a1477c7072dca500a9d80 (diff) | |
download | minetest-dcb30a593dafed89ef52e712533b0706bddbd36e.tar.gz minetest-dcb30a593dafed89ef52e712533b0706bddbd36e.tar.bz2 minetest-dcb30a593dafed89ef52e712533b0706bddbd36e.zip |
Set ENABLE_SYSTEM_JSONCPP to TRUE by default
Diffstat (limited to 'cmake/Modules/FindJson.cmake')
-rw-r--r-- | cmake/Modules/FindJson.cmake | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index a5e9098f8..cce2d387f 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -1,26 +1,25 @@ -# 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 +# Look for JsonCpp, with fallback to bundeled version 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) +option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JsonCpp" TRUE) +set(USE_SYSTEM_JSONCPP FALSE) if(ENABLE_SYSTEM_JSONCPP) find_library(JSON_LIBRARY NAMES jsoncpp) find_path(JSON_INCLUDE_DIR json/allocator.h PATH_SUFFIXES jsoncpp) - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR) - - if(JSON_FOUND) - message(STATUS "Using system JSONCPP library.") + if(JSON_LIBRARY AND JSON_INCLUDE_DIR) + message(STATUS "Using JsonCpp provided by system.") + set(USE_SYSTEM_JSONCPP TRUE) endif() endif() -if(NOT JSON_FOUND) - message(STATUS "Using bundled JSONCPP library.") +if(NOT USE_SYSTEM_JSONCPP) + message(STATUS "Using bundled JsonCpp library.") set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp) set(JSON_LIBRARY jsoncpp) add_subdirectory(lib/jsoncpp) endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR) |