eliminate cJSON submodule

This commit is contained in:
Enno Rehling 2021-02-13 15:10:48 +01:00
parent f78d667258
commit b0093868b3
7 changed files with 67 additions and 15 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "cJSON"]
path = cJSON
url = https://github.com/ennorehling/cJSON.git
[submodule "storage"] [submodule "storage"]
path = storage path = storage
url = https://github.com/ennorehling/storage.git url = https://github.com/ennorehling/storage.git

View File

@ -41,6 +41,7 @@ endif (NOT CURSES_FOUND)
find_package (SQLite3 REQUIRED) find_package (SQLite3 REQUIRED)
find_package (IniParser REQUIRED) find_package (IniParser REQUIRED)
find_package (CJSON REQUIRED)
find_package (EXPAT REQUIRED) find_package (EXPAT REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua REQUIRED)
if (TOLUA_FOUND) if (TOLUA_FOUND)
@ -53,7 +54,6 @@ endif(TOLUA_FOUND)
enable_testing() enable_testing()
add_subdirectory (cJSON)
add_subdirectory (storage) add_subdirectory (storage)
add_subdirectory (clibs) add_subdirectory (clibs)
add_subdirectory (process) add_subdirectory (process)

1
cJSON

@ -1 +0,0 @@
Subproject commit 460207f9c09d501a2e302e5313b2f67dca0d6d63

View File

@ -0,0 +1,59 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindCJSON
-----------
.. versionadded:: 3.20
Find the cJSON libraries, v3
IMPORTED targets
^^^^^^^^^^^^^^^^
This module defines the following :prop_tgt:`IMPORTED` target:
``DaveGamble::CJSON``
Result variables
^^^^^^^^^^^^^^^^
This module will set the following variables if found:
``CJSON_INCLUDE_DIRS``
where to find sqlite3.h, etc.
``CJSON_LIBRARIES``
the libraries to link against to use CJSON.
``CJSON_VERSION``
version of the CJSON library found
``CJSON_FOUND``
TRUE if found
#]=======================================================================]
# Look for the necessary header
find_path(CJSON_INCLUDE_DIR cJSON.h PATH_SUFFIXES cjson)
mark_as_advanced(CJSON_INCLUDE_DIR)
# Look for the necessary library
find_library(CJSON_LIBRARY cjson)
mark_as_advanced(CJSON_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(CJSON
REQUIRED_VARS CJSON_INCLUDE_DIR CJSON_LIBRARY
VERSION_VAR CJSON_VERSION)
# Create the imported target
if(CJSON_FOUND)
set(CJSON_INCLUDE_DIRS ${CJSON_INCLUDE_DIR})
set(CJSON_LIBRARIES ${CJSON_LIBRARY})
if(NOT TARGET DaveGamble::CJSON)
add_library(DaveGamble::CJSON UNKNOWN IMPORTED)
set_target_properties(DaveGamble::CJSON PROPERTIES
IMPORTED_LOCATION "${CJSON_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${CJSON_INCLUDE_DIR}")
endif()
endif()

View File

@ -1,7 +1,6 @@
project (server C) project (server C)
include_directories (${CMAKE_CURRENT_SOURCE_DIR}) include_directories (${CMAKE_CURRENT_SOURCE_DIR})
include_directories (${CJSON_INCLUDE_DIR})
include_directories (${CRYPTO_INCLUDE_DIR}) include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${CLIBS_INCLUDE_DIR}) include_directories (${CLIBS_INCLUDE_DIR})
include_directories (${STORAGE_INCLUDE_DIR}) include_directories (${STORAGE_INCLUDE_DIR})
@ -209,7 +208,7 @@ target_link_libraries(eressea
${LUA_LIBRARIES} ${LUA_LIBRARIES}
${STORAGE_LIBRARIES} ${STORAGE_LIBRARIES}
${CJSON_LIBRARIES} ${CJSON_LIBRARIES}
${INIPARSER_LIBRARIES} ${IniParser_LIBRARIES}
) )
set(TESTS_SRC set(TESTS_SRC
@ -268,7 +267,7 @@ target_link_libraries(test_eressea
${CLIBS_LIBRARIES} ${CLIBS_LIBRARIES}
${STORAGE_LIBRARIES} ${STORAGE_LIBRARIES}
${CJSON_LIBRARIES} ${CJSON_LIBRARIES}
${INIPARSER_LIBRARIES} ${IniParser_LIBRARIES}
) )
add_test(server test_eressea) add_test(server test_eressea)
@ -301,11 +300,8 @@ if (HAVE_LIBBSD)
target_link_libraries(parser bsd) target_link_libraries(parser bsd)
endif (HAVE_LIBBSD) endif (HAVE_LIBBSD)
if (IniParser_FOUND) target_include_directories (game PUBLIC ${CJSON_INCLUDE_DIRS})
target_include_directories(game PUBLIC ${IniParser_INCLUDE_DIRS}) target_include_directories (game PUBLIC ${IniParser_INCLUDE_DIRS})
target_link_libraries(eressea ${IniParser_LIBRARIES})
target_link_libraries(test_eressea ${IniParser_LIBRARIES})
endif (IniParser_FOUND)
if (SQLite3_FOUND) if (SQLite3_FOUND)
target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS}) target_include_directories (game PRIVATE ${SQLite3_INCLUDE_DIRS})

View File

@ -9,7 +9,8 @@
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/terrain.h> #include <kernel/terrain.h>
#include <stream.h> #include <stream.h>
#include "cJSON.h"
#include <cJSON.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>

View File

@ -13,7 +13,7 @@ SET (LIB_SRC
) )
ADD_LIBRARY (crypto ${LIB_SRC}) ADD_LIBRARY (crypto ${LIB_SRC})
set (CRYPTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "cJSON headers") set (CRYPTO_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "crypto headers")
set (CRYPTO_LIBRARIES crypto CACHE INTERNAL "crypto libraries") set (CRYPTO_LIBRARIES crypto CACHE INTERNAL "crypto libraries")
IF(WIN32) IF(WIN32)