mirror of
https://github.com/nlohmann/json.git
synced 2024-12-12 20:19:09 +08:00
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.
This commit is contained in:
parent
a29af9c381
commit
16dca3c6dd
15
meson.build
15
meson.build
@ -6,19 +6,20 @@ project('nlohmann_json',
|
|||||||
default_options: ['cpp_std=c++11'],
|
default_options: ['cpp_std=c++11'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if get_option('MultipleHeaders')
|
||||||
|
incdir = 'include'
|
||||||
|
else
|
||||||
|
incdir = 'single_include'
|
||||||
|
endif
|
||||||
|
|
||||||
nlohmann_json_dep = declare_dependency(
|
nlohmann_json_dep = declare_dependency(
|
||||||
include_directories: include_directories('single_include')
|
include_directories: include_directories(incdir)
|
||||||
)
|
)
|
||||||
meson.override_dependency('nlohmann_json', nlohmann_json_dep)
|
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()
|
if not meson.is_subproject()
|
||||||
install_subdir(
|
install_subdir(
|
||||||
'single_include/nlohmann',
|
incdir / 'nlohmann',
|
||||||
install_dir: get_option('includedir'),
|
install_dir: get_option('includedir'),
|
||||||
install_tag: 'devel',
|
install_tag: 'devel',
|
||||||
)
|
)
|
||||||
|
6
meson_options.txt
Normal file
6
meson_options.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
option(
|
||||||
|
'MultipleHeaders',
|
||||||
|
type: 'boolean',
|
||||||
|
value: true,
|
||||||
|
description: 'Use non-amalgomated version of the library',
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user