Add simple CLI skeleton

Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
This commit is contained in:
Cristian Le 2023-05-10 10:51:46 +02:00
parent 0d60d48a58
commit 8a0b32f1cd
Failed to extract signature

View File

@ -88,7 +88,12 @@ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
GIT_TAG ${JSON_FETCH_VERSION}
FIND_PACKAGE_ARGS
)
list(APPEND fetch_packages nlohmann_json)
FetchContent_Declare(CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11
GIT_TAG v2.3.2
FIND_PACKAGE_ARGS
)
list(APPEND fetch_packages nlohmann_json CLI11)
else ()
# Try to get system installed version
find_package(nlohmann_json QUIET)
@ -100,6 +105,15 @@ else ()
)
list(APPEND fetch_packages nlohmann_json)
endif ()
find_package(CLI11 QUIET)
if (NOT CLI11_FOUND)
# If failed fetch the desired version
FetchContent_Declare(CLI11
GIT_REPOSITORY https://github.com/CLIUtils/CLI11
GIT_TAG v2.3.2
)
list(APPEND fetch_packages nlohmann_json CLI11)
endif ()
endif ()
# Handle configure flags
@ -140,6 +154,12 @@ set_target_properties(nlohmann_json_schema_validator PROPERTIES
OUTPUT_NAME nlohmann_json_validator
)
add_executable(nlohmann_json_schema_validator_cli)
set_target_properties(nlohmann_json_schema_validator_cli PROPERTIES
EXPORT_NAME cli
OUTPUT_NAME json-validator
)
# Main definitions in here
add_subdirectory(src)