git repos / sago_multi_scrambler_puzzle2

commit ffc7bd45

Poul Sander · 2021-12-11 17:18
ffc7bd4541b2fe9dddf0ae74ef5cad7ed35ca0ac patch · browse files

Initial commit

Changed files

A .gitignore
A CMakeLists.txt
A src/sago_multi_scrambler_puzzle2.cpp
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa86521 --- /dev/null +++ b/.gitignore
@@ -0,0 +1,10 @@
+CMakeCache.txt
+CMakeFiles
+*~
+*.bak
+*.exe
+*.so
+*.dll
+*.cmake
+Makefile
+sago_multi_scrambler_puzzle2
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..424da05 --- /dev/null +++ b/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8.9)
+project (sago_multi_scrambler_puzzle2)
+find_package(Boost COMPONENTS program_options REQUIRED)
+add_executable(sago_multi_scrambler_puzzle2 src/sago_multi_scrambler_puzzle2.cpp)
+TARGET_LINK_LIBRARIES( sago_multi_scrambler_puzzle2 ${Boost_LIBRARIES} )
diff --git a/src/sago_multi_scrambler_puzzle2.cpp b/src/sago_multi_scrambler_puzzle2.cpp new file mode 100644 index 0000000..898fc2f --- /dev/null +++ b/src/sago_multi_scrambler_puzzle2.cpp
@@ -0,0 +1,34 @@
+#include <iostream>
+#include <boost/program_options.hpp>
+
+#ifndef VERSIONNUMBER
+#define VERSIONNUMBER "0.1.0"
+#endif
+
+int main(int argc, const char* argv[]) {
+ boost::program_options::options_description desc("Options");
+ desc.add_options()
+ ("version", "Print version information and quit")
+ ("help,h", "Print basic usage information to stdout and quit")
+ ("somestring", boost::program_options::value<std::string>(), "A string to print")
+ ;
+ boost::program_options::variables_map vm;
+ boost::program_options::store(boost::program_options::parse_command_line(argc, argv, desc), vm);
+ boost::program_options::notify(vm);
+ if (vm.count("help")) {
+ std::cout << desc << "\n";
+ return 0;
+ }
+ if (vm.count("version")) {
+ std::cout << "sago_multi_scrambler_puzzle2 " << VERSIONNUMBER << "\n";
+ return 0;
+ }
+ if (vm.count("somestring")) {
+ std::string somestring = vm["somestring"].as<std::string>();
+ std::cout << "Called with a parameter value of: " << somestring << "\n";
+ }
+ else {
+ std::cout << "This program demonstrates boost::program_options. Try \"" << argv[0] << " --help\" or \"" << argv[0] << " --somestring hello\"\n";
+ }
+ return 0;
+}