From a079ed8cde7309aa250cbad7043f00934a15eb59 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Mon, 9 Sep 2024 10:20:00 -0700 Subject: [PATCH] meson: add support for the GlobalUDLs option Signed-off-by: Dylan Baker --- meson.build | 6 ++++++ meson_options.txt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/meson.build b/meson.build index 5b82945d56..699726b9c5 100644 --- a/meson.build +++ b/meson.build @@ -12,7 +12,13 @@ else incdir = 'single_include' endif +cpp_args = [ + '-DJSON_USE_GLOBAL_UDLS=@0@'.format( + (not get_option('GlobalUDLs')).to_int()), +] + nlohmann_json_dep = declare_dependency( + compile_args: cpp_args, include_directories: include_directories(incdir) ) meson.override_dependency('nlohmann_json', nlohmann_json_dep) diff --git a/meson_options.txt b/meson_options.txt index 8291c1ac41..347facca3f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,3 +4,9 @@ option( value: true, description: 'Use non-amalgomated version of the library', ) +option( + 'GlobalUDLs', + type: 'boolean', + value: true, + description: 'Place user-defined string literals in the global namespace', +)