orbea 01e0eab930 Fix Install the locale directory in a standard location
* related https://codeberg.org/minenux/minetest-engine/issues/20
* fixed builds in linux distributions
* already done 2349d31bae
* related: https://github.com/minetest/minetest/pull/9618
* backported ca8957f500
* Fix detection of in-place path_locale when RUN_IN_PLACE=0
* related: https://github.com/minetest/minetest/issues/9745
* cmake: Silence warnings backported https://github.com/minetest/minetest/pull/9750
* Fixes https://github.com/minetest/minetest/issues/9734
2021-11-30 17:29:57 -04:00

27 lines
955 B
CMake

# 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
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)
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.")
endif()
endif()
if(NOT JSON_FOUND)
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()