#include <boost/program_options.hpp>
#include <boost/filesystem.hpp>
namespace po = boost::program_options;
namespace fs = boost::filesystem;
namespace logging = boost::log;
po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);
bool argumentError = false;
if (!vm.count("input")) {
std::cerr << "Input file is mandatory." << std::endl;
argumentError = true;
if (!fs::exists(inputFile)) {
std::cerr << "The input file does not exist." << std::endl;
argumentError = true;
}
}
CMakeLists.txt
# Boost
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC ON)
find_package(Boost REQUIRED COMPONENTS filesystem log program_options)
include_directories(${Boost_INCLUDE_DIRS})
link_libraries(${Boost_LIBRARIES})
网友评论