// include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "codepatterns-config.hpp" #include "version.hpp" namespace po = boost::program_options; /** If pkg-config fails on you, you can call codepatterns-config * in order to retrieve information about how to compile with * CodePatterns. The following options: * -# cflags * -# help * -# ldflags * -# lib * -# version * -# version-full * * @param argc * @param argv * @return */ int main(int argc, char **argv) { // Declare the supported options. po::options_description desc("Allowed options"); desc.add_options() ("cflags", "give CFLAGS info") ("ldflags", "give LDFLAGS info") ("libs", "give LIBS info") ("help", "give help") ("version", "give version info") ("version-full", "give fullversion info") ; po::variables_map vm; po::store(po::parse_command_line(argc, argv, desc), vm); po::notify(vm); // exit right after help if (vm.count("help")) { std::cout << desc << "\n"; return 1; } // exit right after info if (vm.count("version")) { std::cout << CODEPATTERNSVERSION << "\n"; return 0; } if (vm.count("version-full")) { std::cout << CODEPATTERNSFULLVERSION << "\n"; return 0; } // concatenate all info if desired if (vm.count("cflags")) { std::cout << CODEPATTERNSCFLAGS << " "; } if (vm.count("ldflags")) { std::cout << CODEPATTERNSLDFLAGS << " "; } if (vm.count("libs")) { std::cout << CODEPATTERNSLIBS << " "; } std::cout << "\n"; return 0; }