cli11: prefer system package if found

mu embeds a "vendored" version of libcl11 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-cli11=true is
specified.
This commit is contained in:
Dirk-Jan C. Binnema
2025-07-19 10:41:10 +03:00
parent 33958cd0f7
commit 4c2ce92a15
5 changed files with 16 additions and 4 deletions

View File

@ -230,7 +230,9 @@ if not fmt_dep.found() or get_option('use-embedded-fmt')
compile_args: '-DFMT_HEADER_ONLY') compile_args: '-DFMT_HEADER_ONLY')
endif endif
# use system's CLI11 if found, otherwise fall back to embedded version # use system's CLI11 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.
cli11_dep = dependency('CLI11', version: '>=2.4', required:false) cli11_dep = dependency('CLI11', version: '>=2.4', required:false)
if not cli11_dep.found() or get_option('use-embedded-cli11') if not cli11_dep.found() or get_option('use-embedded-cli11')
message('using embedded CLI11') message('using embedded CLI11')

View File

@ -25,6 +25,11 @@ option('use-embedded-fmt',
value: false, value: false,
description: 'Use the embedded fmt, even if system package is found') description: 'Use the embedded fmt, even if system package is found')
option('use-embedded-cli11',
type: 'boolean',
value: false,
description: 'Use the embedded CLI11, even if system package is found')
# #
# language detection # language detection
# #

View File

@ -1,4 +1,4 @@
## Copyright (C) 2021-2023 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> ## Copyright (C) 2021-2025 Dirk-Jan C. Binnema <djcb@djcbsoftware.nl>
## ##
## This program is free software; you can redistribute it and/or modify ## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by ## it under the terms of the GNU General Public License as published by
@ -34,7 +34,8 @@ mu = executable(
'mu-cmd-view.cc', 'mu-cmd-view.cc',
'mu-cmd.cc' 'mu-cmd.cc'
], ],
dependencies: [ glib_dep, gmime_dep, lib_mu_dep, mu_scm_dep, thread_dep, config_h_dep ], dependencies: [ glib_dep, gmime_dep, cli11_dep,
lib_mu_dep, mu_scm_dep, thread_dep, config_h_dep ],
cpp_args: ['-DMU_SCRIPTS_DIR="'+ join_paths(datadir, 'mu', 'scripts') + '"'], cpp_args: ['-DMU_SCRIPTS_DIR="'+ join_paths(datadir, 'mu', 'scripts') + '"'],
install: true) install: true)
# #

View File

@ -49,7 +49,11 @@
#include "mu-options.hh" #include "mu-options.hh"
#include "mu-script.hh" #include "mu-script.hh"
#include <thirdparty/CLI11.hpp> #ifdef USE_EMBEDDED_CLI11
#include "CLI11.hpp"
#else
#include "CLI/CLI.hpp"
#endif
using namespace Mu; using namespace Mu;