meson: handle single header and multiheader the same way CMake does

This uses a meson option (set in `meson_options.txt`) to control whether
multi-header or single-header setup is wanted.

Signed-off-by: Dylan Baker <dylan@pnwbakers.com>
This commit is contained in:
Dylan Baker
2026-09-27 14:47:02 +02:00
committed by Niels Lohmann
parent 605cc6c81d
commit 91365ca3b2
2 changed files with 14 additions and 7 deletions
+8 -7
View File
@@ -6,19 +6,20 @@ project('nlohmann_json',
default_options: ['cpp_std=c++11'],
)
if get_option('MultipleHeaders')
incdir = 'include'
else
incdir = 'single_include'
endif
nlohmann_json_dep = declare_dependency(
include_directories: include_directories('single_include')
include_directories: include_directories(incdir)
)
meson.override_dependency('nlohmann_json', nlohmann_json_dep)
nlohmann_json_multiple_headers = declare_dependency(
include_directories: include_directories('include')
)
meson.override_dependency('nlohmann_json_multiple_headers', nlohmann_json_multiple_headers)
if not meson.is_subproject()
install_subdir(
'single_include/nlohmann',
incdir / 'nlohmann',
install_dir: get_option('includedir'),
install_tag: 'devel',
)
+6
View File
@@ -0,0 +1,6 @@
option(
'MultipleHeaders',
type: 'boolean',
value: true,
description: 'Use non-amalgamated version of the library',
)