Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Set ENABLE_SYSTEM_JSONCPP to TRUE by default
- Loading branch information
Showing
4 changed files
with
15 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |