Merge 7b1d6b58ec589bf79818da587bbc06af06406c02 into ca98c98457b1163cca1f7d8db62827c115fec6d1

This commit is contained in:
SwintonStreet 2025-05-18 22:54:28 +01:00 committed by GitHub
commit df35fe54f7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 40 additions and 35 deletions

View File

@ -46,6 +46,36 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(JSONCPP_HAS_STRING_VIEW_DEFAULT OFF)
if (${CMAKE_CXX_STANDARD} GREATER_EQUAL 17)
set(JSONCPP_HAS_STRING_VIEW_DEFAULT ON)
endif()
option(JSONCPP_HAS_STRING_VIEW "Enable support for string view" ${JSONCPP_HAS_STRING_VIEW_DEFAULT})
configure_file(configure/configure.h.in include/json/configure.h)
set(JSONCPP_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/include)
file(
COPY include/json
DESTINATION ${JSONCPP_INCLUDE_DIR}
FILES_MATCHING
PATTERN "*.h"
)
set(PUBLIC_HEADERS
${JSONCPP_INCLUDE_DIR}/json/config.h
${JSONCPP_INCLUDE_DIR}/json/configure.h
${JSONCPP_INCLUDE_DIR}/json/forwards.h
${JSONCPP_INCLUDE_DIR}/json/json_features.h
${JSONCPP_INCLUDE_DIR}/json/value.h
${JSONCPP_INCLUDE_DIR}/json/reader.h
${JSONCPP_INCLUDE_DIR}/json/version.h
${JSONCPP_INCLUDE_DIR}/json/writer.h
${JSONCPP_INCLUDE_DIR}/json/assertions.h
)
# Ensure that CMAKE_BUILD_TYPE has a value specified for single configuration generators.
if(NOT DEFINED CMAKE_BUILD_TYPE AND NOT DEFINED CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE Release CACHE STRING

1
configure/configure.h.in Normal file
View File

@ -0,0 +1 @@
#cmakedefine JSONCPP_HAS_STRING_VIEW

View File

@ -1,5 +1,3 @@
file(GLOB INCLUDE_FILES "json/*.h")
install(FILES
${INCLUDE_FILES}
${PUBLIC_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json)

View File

@ -39,10 +39,6 @@
#endif
#endif
#if __cplusplus >= 201703L
#define JSONCPP_HAS_STRING_VIEW 1
#endif
#include <array>
#include <exception>
#include <map>
@ -50,6 +46,8 @@
#include <string>
#include <vector>
#include "json/configure.h"
#ifdef JSONCPP_HAS_STRING_VIEW
#include <string_view>
#endif
@ -581,7 +579,7 @@ public:
/// Do nothing if it did not exist.
/// \pre type() is objectValue or nullValue
/// \post type() is unchanged
#if JSONCPP_HAS_STRING_VIEW
#ifdef JSONCPP_HAS_STRING_VIEW
void removeMember(std::string_view key);
#else
void removeMember(const char* key);
@ -595,7 +593,7 @@ public:
* \param key may contain embedded nulls.
* \return true iff removed (no exceptions)
*/
#if JSONCPP_HAS_STRING_VIEW
#ifdef JSONCPP_HAS_STRING_VIEW
bool removeMember(std::string_view key, Value* removed);
#else
bool removeMember(String const& key, Value* removed);

View File

@ -25,19 +25,6 @@ if(NOT (HAVE_CLOCALE AND HAVE_LCONV_SIZE AND HAVE_DECIMAL_POINT AND HAVE_LOCALEC
endif()
endif()
set(JSONCPP_INCLUDE_DIR ../../include)
set(PUBLIC_HEADERS
${JSONCPP_INCLUDE_DIR}/json/config.h
${JSONCPP_INCLUDE_DIR}/json/forwards.h
${JSONCPP_INCLUDE_DIR}/json/json_features.h
${JSONCPP_INCLUDE_DIR}/json/value.h
${JSONCPP_INCLUDE_DIR}/json/reader.h
${JSONCPP_INCLUDE_DIR}/json/version.h
${JSONCPP_INCLUDE_DIR}/json/writer.h
${JSONCPP_INCLUDE_DIR}/json/assertions.h
)
source_group("Public API" FILES ${PUBLIC_HEADERS})
set(JSONCPP_SOURCES
@ -131,7 +118,7 @@ if(BUILD_SHARED_LIBS)
target_include_directories(${SHARED_LIB} PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
$<BUILD_INTERFACE:${JSONCPP_INCLUDE_DIR}>
)
list(APPEND CMAKE_TARGETS ${SHARED_LIB})
@ -164,7 +151,7 @@ if(BUILD_STATIC_LIBS)
target_include_directories(${STATIC_LIB} PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
$<BUILD_INTERFACE:${JSONCPP_INCLUDE_DIR}>
)
list(APPEND CMAKE_TARGETS ${STATIC_LIB})
@ -190,7 +177,7 @@ if(BUILD_OBJECT_LIBS)
target_include_directories(${OBJECT_LIB} PUBLIC
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/${JSONCPP_INCLUDE_DIR}>
$<BUILD_INTERFACE:${JSONCPP_INCLUDE_DIR}>
)
list(APPEND CMAKE_TARGETS ${OBJECT_LIB})
@ -202,4 +189,3 @@ install(TARGETS ${CMAKE_TARGETS} ${INSTALL_EXPORT}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
OBJECTS DESTINATION ${CMAKE_INSTALL_LIBDIR}
)

View File

@ -19,7 +19,6 @@
#include <limits>
#include <memory>
#include <set>
#include <sstream>
#include <utility>
#include <cstdio>

View File

@ -5,6 +5,7 @@
#if !defined(JSON_IS_AMALGAMATION)
#include <json/assertions.h>
#include <json/configure.h>
#include <json/value.h>
#include <json/writer.h>
#endif // if !defined(JSON_IS_AMALGAMATION)
@ -13,8 +14,6 @@
#include <cmath>
#include <cstddef>
#include <cstring>
#include <iostream>
#include <sstream>
#include <utility>
#ifdef JSONCPP_HAS_STRING_VIEW

View File

@ -13,10 +13,8 @@
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <memory>
#include <set>
#include <sstream>
#include <utility>
#if defined(_MSC_VER)

View File

@ -9,7 +9,6 @@
#include <json/config.h>
#include <json/json.h>
#include <memory>
#include <string>
namespace Json {
class Exception;

View File

@ -12,8 +12,6 @@
#include <json/config.h>
#include <json/value.h>
#include <json/writer.h>
#include <sstream>
#include <string>
// //////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////

View File

@ -12,7 +12,6 @@
#include "fuzz.h"
#include "jsontest.h"
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>