mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2025-08-04 10:36:23 -04:00
Merge 7b1d6b58ec589bf79818da587bbc06af06406c02 into ca98c98457b1163cca1f7d8db62827c115fec6d1
This commit is contained in:
commit
df35fe54f7
@ -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
1
configure/configure.h.in
Normal file
@ -0,0 +1 @@
|
||||
#cmakedefine JSONCPP_HAS_STRING_VIEW
|
@ -1,5 +1,3 @@
|
||||
file(GLOB INCLUDE_FILES "json/*.h")
|
||||
install(FILES
|
||||
${INCLUDE_FILES}
|
||||
${PUBLIC_HEADERS}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json)
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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}
|
||||
)
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#include <cstdio>
|
||||
|
@ -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
|
||||
|
@ -13,10 +13,8 @@
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <iomanip>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <sstream>
|
||||
#include <utility>
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
@ -9,7 +9,6 @@
|
||||
#include <json/config.h>
|
||||
#include <json/json.h>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace Json {
|
||||
class Exception;
|
||||
|
@ -12,8 +12,6 @@
|
||||
#include <json/config.h>
|
||||
#include <json/value.h>
|
||||
#include <json/writer.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
// //////////////////////////////////////////////////////////////////
|
||||
|
@ -12,7 +12,6 @@
|
||||
|
||||
#include "fuzz.h"
|
||||
#include "jsontest.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <cstring>
|
||||
#include <functional>
|
||||
|
Loading…
x
Reference in New Issue
Block a user