fmt: prefer system package if found

mu embeds a "vendored" subset of the libfmt package under thirdparty; but it's
better to use the system-package if the user has one.

So, use the system package if found or user -Duse-embedded-fmt=true is
specified.
This commit is contained in:
Dirk-Jan C. Binnema
2025-07-19 09:31:16 +03:00
parent f90839b48b
commit 33958cd0f7
20 changed files with 40 additions and 13 deletions

View File

@ -219,6 +219,26 @@ host_system = host_machine.system()
# soft dependencies
#
# use system's fmt if found, otherwise fall back to embedded version
# we can probably get away with a lower version, but want to have (roughly)
# the same in embedded / system.
fmt_dep = dependency('fmt', version: '>=11.1', required:false)
if not fmt_dep.found() or get_option('use-embedded-fmt')
message('using embedded fmt')
fmt_dep = declare_dependency(
include_directories : join_paths('.', 'thirdparty/fmt'),
compile_args: '-DFMT_HEADER_ONLY')
endif
# use system's CLI11 if found, otherwise fall back to embedded version
cli11_dep = dependency('CLI11', version: '>=2.4', required:false)
if not cli11_dep.found() or get_option('use-embedded-cli11')
message('using embedded CLI11')
cli11_dep = declare_dependency(
compile_args: '-DUSE_EMBEDDED_CLI11',
include_directories : join_paths('.', 'thirdparty/cli11'))
endif
#
# logging
#
@ -280,7 +300,6 @@ if get_option('readline').enabled()
config_h_data.set('HAVE_READLINE_HISTORY_H', 1)
endif
################################################################################
# write out version.texi (for texinfo builds in mu4e, guile)
version_texi_data=configuration_data()