mirror of
https://github.com/nlohmann/json.git
synced 2026-10-02 04:30:29 +00:00
Add DisableTupleReferenceConversion to Meson and the CMake pkg-config file
JSON_DisableTupleReferenceConversion (#5598) came in with the develop merge. Meson gets the matching option, and both the Meson and the CMake pkg-config file carry JSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1 when it is enabled. The ci_meson_install job checks it. Reported by @heitbaum in #5587. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -51,7 +51,7 @@ jobs:
|
||||
cmake --build build-import
|
||||
- name: Install with Meson and non-default options
|
||||
run: |
|
||||
meson setup build-meson-options --prefix=${{ github.workspace }}/install-options -DMultipleHeaders=true -DDiagnostics=true -DGlobalUDLs=false
|
||||
meson setup build-meson-options --prefix=${{ github.workspace }}/install-options -DMultipleHeaders=true -DDiagnostics=true -DGlobalUDLs=false -DDisableTupleReferenceConversion=true
|
||||
meson install -C build-meson-options
|
||||
- name: Check that the options reach the installed files
|
||||
run: |
|
||||
@@ -60,7 +60,8 @@ jobs:
|
||||
echo "$cflags"
|
||||
echo "$cflags" | grep -q -- '-DJSON_DIAGNOSTICS=1'
|
||||
echo "$cflags" | grep -q -- '-DJSON_USE_GLOBAL_UDLS=0'
|
||||
grep -q 'JSON_USE_GLOBAL_UDLS=0;JSON_DIAGNOSTICS=1' install-options/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake
|
||||
echo "$cflags" | grep -q -- '-DJSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1'
|
||||
grep -q 'JSON_USE_GLOBAL_UDLS=0;JSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1;JSON_DIAGNOSTICS=1' install-options/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake
|
||||
cmake -S tests/cmake_import/project -B build-import-options -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install-options
|
||||
cmake --build build-import-options
|
||||
- name: Install with Meson and the include directory outside the prefix
|
||||
|
||||
@@ -186,6 +186,9 @@ endif()
|
||||
if (JSON_DisableEnumSerialization)
|
||||
string(APPEND NLOHMANN_JSON_PKGCONFIG_CFLAGS " -DJSON_DISABLE_ENUM_SERIALIZATION=1")
|
||||
endif()
|
||||
if (JSON_DisableTupleReferenceConversion)
|
||||
string(APPEND NLOHMANN_JSON_PKGCONFIG_CFLAGS " -DJSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1")
|
||||
endif()
|
||||
if (JSON_Diagnostics)
|
||||
string(APPEND NLOHMANN_JSON_PKGCONFIG_CFLAGS " -DJSON_DIAGNOSTICS=1")
|
||||
endif()
|
||||
|
||||
@@ -128,8 +128,8 @@ subproject fallback, rather than using the subproject directly.
|
||||
|
||||
The options that change the library's configuration are available in Meson as well, named like the
|
||||
[CMake options](cmake.md#cmake-options) without the `JSON_` prefix: `MultipleHeaders`, `GlobalUDLs`,
|
||||
`ImplicitConversions`, `DisableEnumSerialization`, `Diagnostics`, `Diagnostic_Positions`,
|
||||
`LegacyDiscardedValueComparison`, and `StrictNulHandling`. They have the same defaults as in CMake, except that
|
||||
`ImplicitConversions`, `DisableEnumSerialization`, `DisableTupleReferenceConversion`, `Diagnostics`,
|
||||
`Diagnostic_Positions`, `LegacyDiscardedValueComparison`, and `StrictNulHandling`. They have the same defaults as in CMake, except that
|
||||
`MultipleHeaders` is `false`. Set them with `-D` when setting up the build, or with the subproject name as prefix when
|
||||
the library is used as a subproject:
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@ endif
|
||||
if get_option('DisableEnumSerialization')
|
||||
json_defines += 'JSON_DISABLE_ENUM_SERIALIZATION=1'
|
||||
endif
|
||||
if get_option('DisableTupleReferenceConversion')
|
||||
json_defines += 'JSON_DISABLE_TUPLE_REFERENCE_CONVERSION=1'
|
||||
endif
|
||||
if get_option('Diagnostics')
|
||||
json_defines += 'JSON_DIAGNOSTICS=1'
|
||||
endif
|
||||
|
||||
@@ -22,6 +22,12 @@ option(
|
||||
value: false,
|
||||
description: 'Disable default integer enum serialization',
|
||||
)
|
||||
option(
|
||||
'DisableTupleReferenceConversion',
|
||||
type: 'boolean',
|
||||
value: false,
|
||||
description: 'Disable conversion from a one-element tuple of a JSON reference',
|
||||
)
|
||||
option(
|
||||
'Diagnostics',
|
||||
type: 'boolean',
|
||||
|
||||
Reference in New Issue
Block a user