diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f895d66..a3e2dbc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,13 +6,17 @@ target_sources(nlohmann_json_schema_validator PRIVATE json-patch.cpp string-format-check.cpp ) +target_sources(nlohmann_json_schema_validator_cli PRIVATE + cli.cpp) + target_include_directories(nlohmann_json_schema_validator PUBLIC $ $ ) - set_target_properties(nlohmann_json_schema_validator PROPERTIES PUBLIC_HEADER nlohmann/json-schema.hpp) +target_link_libraries(nlohmann_json_schema_validator_cli PRIVATE + nlohmann_json_schema_validator CLI11::CLI11) # TODO: Why would this need to be if guarded? if (JSON_VALIDATOR_SHARED_LIBS) diff --git a/src/cli.cpp b/src/cli.cpp new file mode 100644 index 0000000..94519eb --- /dev/null +++ b/src/cli.cpp @@ -0,0 +1,17 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + CLI::App app{"Json schema validator", "json-validator"}; + // TODO: Move to a generated header file + app.set_version_flag("--version", "2.2.0"); + + try { + app.parse(argc, argv); + } catch (const CLI::ParseError &e) { + return app.exit(e); + } + return 0; +}