diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-02-27 18:05:29 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-03-27 15:00:48 -0400 |
commit | 93fcab952b28f4db39d9326b83f14cbd86c0cf17 (patch) | |
tree | 4a2f0fcf7341c596f50ec24ff0a5a81d43d17ccd /cmake/Modules/FindJson.cmake | |
parent | 284fefb0c32e8222fadd78eeec6e7e718fe25668 (diff) | |
download | minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.tar.gz minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.tar.bz2 minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.zip |
Clean up and tweak build system
* Combine client and server man pages.
* Update unit test options and available databases in man page.
* Add `--worldname` to man page.
* Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
* Disable server build by default on all operating systems.
* Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
* Enable LevelDB, Redis, and FreeType detection by default.
* Remove the `VERSION_PATCH_ORIG` hack.
* Add option to search for and use system JSONCPP.
* Remove broken LuaJIT version detection.
* Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
* Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
* Clean up style of CMake files.
Diffstat (limited to 'cmake/Modules/FindJson.cmake')
-rw-r--r-- | cmake/Modules/FindJson.cmake | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index a9178a225..8e355b93f 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -1,18 +1,27 @@ -# Look for json, use our own if not found +# 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 -#FIND_PATH(JSON_INCLUDE_DIR json.h) +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) -#FIND_LIBRARY(JSON_LIBRARY NAMES jsoncpp) +if(ENABLE_SYSTEM_JSONCPP) + find_library(JSON_LIBRARY NAMES jsoncpp) + find_path(JSON_INCLUDE_DIR json/features.h) -#IF(JSON_LIBRARY AND JSON_INCLUDE_DIR) -# SET( JSON_FOUND TRUE ) -#ENDIF(JSON_LIBRARY AND JSON_INCLUDE_DIR) + 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() -#IF(JSON_FOUND) -# MESSAGE(STATUS "Found system jsoncpp header file in ${JSON_INCLUDE_DIR}") -# MESSAGE(STATUS "Found system jsoncpp library ${JSON_LIBRARY}") -#ELSE(JSON_FOUND) - SET(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json) - SET(JSON_LIBRARY jsoncpp) - MESSAGE(STATUS "Using project jsoncpp library") -#ENDIF(JSON_FOUND) |