Skip to content

Commit dcb30a5

Browse files
committedMar 7, 2021
Set ENABLE_SYSTEM_JSONCPP to TRUE by default
1 parent 593d5f4 commit dcb30a5

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed
 

Diff for: ‎CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ find_package(GMP REQUIRED)
204204
find_package(Json REQUIRED)
205205
find_package(Lua REQUIRED)
206206

207-
# JsonCPP doesn't compile well on GCC 4.8
208-
if(NOT ENABLE_SYSTEM_JSONCPP)
207+
# JsonCpp doesn't compile well on GCC 4.8
208+
if(NOT USE_SYSTEM_JSONCPP)
209209
set(GCC_MINIMUM_VERSION "4.9")
210210
endif()
211211

Diff for: ‎README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ General options and their default values:
238238
ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua)
239239
ENABLE_PROMETHEUS=OFF - Build with Prometheus metrics exporter (listens on tcp/30000 by default)
240240
ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp)
241-
ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system
241+
ENABLE_SYSTEM_JSONCPP=ON - Use JsonCPP from system
242242
OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference
243243
RUN_IN_PLACE=FALSE - Create a portable install (worlds, settings etc. in current directory)
244244
USE_GPROF=FALSE - Enable profiling using GProf
@@ -354,7 +354,7 @@ This is outdated and not recommended. Follow the instructions on https://dev.min
354354
Run the following script in PowerShell:
355355

356356
```powershell
357-
cmake . -G"Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT=OFF -DENABLE_CURSES=OFF -DENABLE_SYSTEM_JSONCPP=ON
357+
cmake . -G"Visual Studio 15 2017 Win64" -DCMAKE_TOOLCHAIN_FILE=D:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT=OFF -DENABLE_CURSES=OFF
358358
cmake --build . --config Release
359359
```
360360
Make sure that the right compiler is selected and the path to the vcpkg toolchain is correct.

Diff for: ‎cmake/Modules/FindGMP.cmake

-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ if(ENABLE_SYSTEM_GMP)
1212
else()
1313
message (STATUS "Detecting GMP from system failed.")
1414
endif()
15-
else()
16-
message (STATUS "Detecting GMP from system disabled! (ENABLE_SYSTEM_GMP=0)")
1715
endif()
1816

1917
if(NOT USE_SYSTEM_GMP)

Diff for: ‎cmake/Modules/FindJson.cmake

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,25 @@
1-
# Look for JSONCPP if asked to.
2-
# We use a bundled version by default because some distros ship versions of
3-
# JSONCPP that cause segfaults and other memory errors when we link with them.
4-
# See https://github.com/minetest/minetest/issues/1793
1+
# Look for JsonCpp, with fallback to bundeled version
52

63
mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR)
7-
option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause segfaults and other memory errors!" FALSE)
4+
option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JsonCpp" TRUE)
5+
set(USE_SYSTEM_JSONCPP FALSE)
86

97
if(ENABLE_SYSTEM_JSONCPP)
108
find_library(JSON_LIBRARY NAMES jsoncpp)
119
find_path(JSON_INCLUDE_DIR json/allocator.h PATH_SUFFIXES jsoncpp)
1210

13-
include(FindPackageHandleStandardArgs)
14-
find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)
15-
16-
if(JSON_FOUND)
17-
message(STATUS "Using system JSONCPP library.")
11+
if(JSON_LIBRARY AND JSON_INCLUDE_DIR)
12+
message(STATUS "Using JsonCpp provided by system.")
13+
set(USE_SYSTEM_JSONCPP TRUE)
1814
endif()
1915
endif()
2016

21-
if(NOT JSON_FOUND)
22-
message(STATUS "Using bundled JSONCPP library.")
17+
if(NOT USE_SYSTEM_JSONCPP)
18+
message(STATUS "Using bundled JsonCpp library.")
2319
set(JSON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/jsoncpp)
2420
set(JSON_LIBRARY jsoncpp)
2521
add_subdirectory(lib/jsoncpp)
2622
endif()
23+
24+
include(FindPackageHandleStandardArgs)
25+
find_package_handle_standard_args(Json DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR)

0 commit comments

Comments
 (0)
Please sign in to comment.