Skip to content

Commit

Permalink
meson: add support for the GlobalUDLs option
Browse files Browse the repository at this point in the history
  • Loading branch information
dcbaker committed Sep 9, 2024
1 parent dfe3f94 commit 46b6276
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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++'
)
Expand Down
6 changes: 6 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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',
)

0 comments on commit 46b6276

Please sign in to comment.