From 46b6276124e12d93a4d918621ed30545d70df132 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 --- meson.build | 7 +++++++ meson_options.txt | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/meson.build b/meson.build index c283e34ab6..bf0be7f81f 100644 --- a/meson.build +++ b/meson.build @@ -12,7 +12,13 @@ else incdir = '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) @@ -26,6 +32,7 @@ if not meson.is_subproject() pkgc = import('pkgconfig') pkgc.generate(name: 'nlohmann_json', + extra_cflags: cpp_args, version: meson.project_version(), description: 'JSON for Modern C++' ) 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', +)