build(meson): use override_dependency if supported (#116)

This improves user experience when using tomlplusplus as a Meson
subproject.

With this change users will be able to simply call
dependency('tomlplusplus') and have Meson automatically resolve the
dependency from the subproject if it is not found on the system.

Without this, users always have to explicitly call
dependency('tomlplusplus', fallback:['tomlplusplus','tomlplusplus_dep'])

A lot of saved keystrokes :)
This commit is contained in:
Andrea Pappacoda 2021-09-22 18:53:27 +02:00 committed by GitHub
parent 73870cef54
commit fe28ec8d24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -508,6 +508,10 @@ tomlplusplus_dep = declare_dependency(
version: meson.project_version(),
)
if meson.version().version_compare('>=0.54.0')
meson.override_dependency('tomlplusplus', tomlplusplus_dep)
endif
if not is_subproject
import('pkgconfig').generate(
name: meson.project_name(),