build: get CLI11 via file download if not on system
This commit is contained in:
committed by
Chris Rizzitello
parent
add8d5370a
commit
710c1dd353
@ -30,7 +30,6 @@ macro(configure_libs)
|
||||
configure_openssl()
|
||||
configure_coverage()
|
||||
configure_tomlplusplus()
|
||||
configure_cli11()
|
||||
|
||||
if(BUILD_TESTS)
|
||||
configure_gtest()
|
||||
@ -673,35 +672,3 @@ macro(configure_tomlplusplus)
|
||||
endif()
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(configure_cli11)
|
||||
file(GLOB cli11_dir ${PROJECT_SOURCE_DIR}/subprojects/CLI11-*)
|
||||
|
||||
if(cli11_dir)
|
||||
set(DEFAULT_SYSTEM_CLI11 OFF)
|
||||
else()
|
||||
set(DEFAULT_SYSTEM_CLI11 ON)
|
||||
endif()
|
||||
|
||||
option(SYSTEM_CLI11 "Use system CLI11" ${DEFAULT_SYSTEM_CLI11})
|
||||
if(SYSTEM_CLI11)
|
||||
message(VERBOSE "Using system CLI11")
|
||||
find_package(CLI11)
|
||||
if(CLI11_FOUND)
|
||||
message(STATUS "CLI11 version: ${CLI11_VERSION}")
|
||||
else()
|
||||
message(WARNING "System CLI11 not found")
|
||||
endif()
|
||||
else()
|
||||
if(EXISTS ${cli11_dir})
|
||||
message(VERBOSE "Using local CLI11")
|
||||
set(HAVE_CLI11 true)
|
||||
add_definitions(-DHAVE_CLI11=1)
|
||||
include_directories(${cli11_dir}/include)
|
||||
else()
|
||||
message(WARNING "Local CLI11 subproject not found at: ${cli11_dir}")
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
@ -16,13 +16,6 @@ else
|
||||
subproject('tomlplusplus')
|
||||
endif
|
||||
|
||||
system_cli11 = get_option('system-cli11')
|
||||
if system_cli11
|
||||
dependency('cli11', required: false)
|
||||
else
|
||||
subproject('cli11')
|
||||
endif
|
||||
|
||||
system_gtest = get_option('system-gtest')
|
||||
if system_gtest
|
||||
dependency('gtest', required: false)
|
||||
|
||||
@ -2,4 +2,3 @@ option('system-gtest', type: 'boolean', value: true, description: 'Use system gt
|
||||
option('system-libportal', type: 'boolean', value: true, description: 'Use system libportal')
|
||||
option('system-libei', type: 'boolean', value: true, description: 'Use system libei')
|
||||
option('system-tomlplusplus', type: 'boolean', value: true, description: 'Use system tomlplusplus')
|
||||
option('system-cli11', type: 'boolean', value: true, description: 'Use system cli11')
|
||||
|
||||
@ -35,7 +35,6 @@ def setup(no_system_list, static_list):
|
||||
if env.is_windows():
|
||||
cmd.append("-Dsystem-gtest=false")
|
||||
cmd.append("-Dsystem-tomlplusplus=false")
|
||||
cmd.append("-Dsystem-cli11=false")
|
||||
|
||||
for subproject in no_system_list or []:
|
||||
cmd.append(f"-Dsystem-{subproject}=false")
|
||||
|
||||
@ -59,9 +59,7 @@
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CLI11
|
||||
#include <CLI/CLI.hpp>
|
||||
#endif
|
||||
|
||||
using namespace deskflow;
|
||||
|
||||
@ -189,7 +187,6 @@ void App::initApp(int argc, const char **argv)
|
||||
{
|
||||
|
||||
std::string configFilename;
|
||||
#if HAVE_CLI11
|
||||
CLI::App cliApp{kAppDescription, kAppName};
|
||||
cliApp.add_option("--config-toml", configFilename, "Use TOML configuration file");
|
||||
|
||||
@ -197,7 +194,6 @@ void App::initApp(int argc, const char **argv)
|
||||
cliApp.allow_extras();
|
||||
|
||||
cliApp.parse(argc, argv);
|
||||
#endif // HAVE_CLI11
|
||||
|
||||
if (!configFilename.empty()) {
|
||||
Config config(configFilename, configSection());
|
||||
|
||||
@ -14,6 +14,24 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
find_package(CLI11 QUIET)
|
||||
if(CLI11_FOUND)
|
||||
message(STATUS "CLI11 [System] Version: ${CLI11_VERSION}")
|
||||
set(cli11_lib CLI11::CLI11)
|
||||
else()
|
||||
#Be sure to update the version and MD5 together
|
||||
set(CLI11_VERSION 2.4.2)
|
||||
set(CLI11_MD5 d7923d1ca06d03e2299e55cad532d126)
|
||||
file(
|
||||
DOWNLOAD "https://github.com/CLIUtils/CLI11/releases/download/v${CLI11_VERSION}/CLI11.hpp"
|
||||
"${CMAKE_BINARY_DIR}/include/CLI/CLI.hpp"
|
||||
EXPECTED_MD5 ${CLI11_MD5}
|
||||
)
|
||||
set(cli11_inc_dir "${CMAKE_BINARY_DIR}/include")
|
||||
message(STATUS "CLI11 [Downloaded] Version: ${CLI11_VERSION}")
|
||||
message(STATUS "CLI11 INC_DIR: ${cli11_inc_dir}")
|
||||
endif()
|
||||
|
||||
set(lib_name app)
|
||||
|
||||
file(GLOB headers "*.h" "languages/*.h")
|
||||
@ -42,6 +60,8 @@ endif()
|
||||
|
||||
add_library(${lib_name} STATIC ${sources})
|
||||
|
||||
target_include_directories( ${lib_name} PRIVATE ${cli11_inc_dir})
|
||||
|
||||
if(UNIX)
|
||||
target_link_libraries(
|
||||
${lib_name}
|
||||
@ -52,7 +72,9 @@ if(UNIX)
|
||||
base
|
||||
platform
|
||||
mt
|
||||
server)
|
||||
server
|
||||
${cli11_lib}
|
||||
)
|
||||
|
||||
if(NOT APPLE)
|
||||
target_link_libraries(${lib_name} pugixml)
|
||||
|
||||
@ -1,10 +0,0 @@
|
||||
[wrap-file]
|
||||
directory = CLI11-2.4.1
|
||||
source_url = https://github.com/CLIUtils/CLI11/archive/refs/tags/v2.4.1.tar.gz
|
||||
source_filename = CLI11-2.4.1.tar.gz
|
||||
source_hash = 73b7ec52261ce8fe980a29df6b4ceb66243bb0b779451dbd3d014cfec9fdbb58
|
||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/cli11_2.4.1-1/CLI11-2.4.1.tar.gz
|
||||
wrapdb_version = 2.4.1-1
|
||||
|
||||
[provide]
|
||||
cli11 = CLI11_dep
|
||||
Reference in New Issue
Block a user