diff --git a/cmake/Templates/HEJ-config.cc.in b/cmake/Templates/HEJ-config.cc.in index 02c0f73..62929fd 100644 --- a/cmake/Templates/HEJ-config.cc.in +++ b/cmake/Templates/HEJ-config.cc.in @@ -1,111 +1,111 @@ /** * \authors The HEJ collaboration (see AUTHORS for details) * \date 2019-2022 * \copyright GPLv2 or later */ #include #include #include #include #include #include "cxxopts.hpp" #include "HEJ/ConfigFlags.hh" namespace { - constexpr std::string_view get_features() { - std::string_view features = "" + constexpr std::string_view get_optional_dependencies() { + std::string_view optional_dependencies = "" #ifdef HEJ_BUILD_WITH_QCDLOOP "QCDloop " #endif #ifdef HEJ_BUILD_WITH_HepMC2 "HepMC2 " #endif #ifdef HEJ_BUILD_WITH_HepMC3 "HepMC3 " #endif #ifdef HEJ_BUILD_WITH_RIVET #ifdef HEJ_USE_RIVET2 "Rivet2 " #else "Rivet3 " #endif #endif #ifdef HEJ_BUILD_WITH_HDF5 "HDF5 " #endif ; - if(! features.empty()) { - features.remove_suffix(1); + if(! optional_dependencies.empty()) { + optional_dependencies.remove_suffix(1); } - return features; + return optional_dependencies; } - constexpr std::string_view FEATURES = get_features(); + constexpr std::string_view OPTIONAL_DEPENDENCIES = get_optional_dependencies(); } int main(int argc, char** argv) { cxxopts::Options options{ argv[0], "Configuration of the @CMAKE_PROJECT_NAME@ installation" }; options.add_options() ("h,help", "show this help message and exit") ("prefix", "show @CMAKE_PROJECT_NAME@ installation prefix") ("includedir", "show the path with the installed @CMAKE_PROJECT_NAME@ header files") ("bindir", "show the path with the installed @CMAKE_PROJECT_NAME@ executable") ("libdir", "show the path with the installed @CMAKE_PROJECT_NAME@ library file") ("libs", "show flags for linking the @CMAKE_PROJECT_NAME@ library") ("cxxflags", "show the compiler flags for the @CMAKE_PROJECT_NAME@ headers") ("cxx", "show the compiler used to build @CMAKE_PROJECT_NAME@") - ("features", "show the optional features enabled when building @CMAKE_PROJECT_NAME@") + ("optional-dependencies", "show the optional dependencies enabled when building @CMAKE_PROJECT_NAME@") ("version", "show the installed @CMAKE_PROJECT_NAME@ version") ("revision", "show the hash of the installed @CMAKE_PROJECT_NAME@ git revision") ; if(argc == 1) { std::cout << options.help(); return EXIT_SUCCESS; } try { const auto opts = options.parse(argc, argv); if(opts.count("help")) { std::cout << options.help(); return EXIT_SUCCESS; } std::string output{}; for(auto const & op: opts.arguments()){ if(op.key()=="prefix") output += "@CMAKE_INSTALL_PREFIX@"; else if(op.key()=="includedir") output += "@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDE_DIR_BASE@"; else if(op.key()=="bindir") output += "@CMAKE_INSTALL_PREFIX@/@INSTALL_BIN_DIR@"; else if(op.key()=="libdir") output += "@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@"; else if(op.key()=="libs") output += "-L@CMAKE_INSTALL_PREFIX@/@INSTALL_LIB_DIR@ -lHEJ"; else if(op.key()=="cxxflags") output += "-I@CMAKE_INSTALL_PREFIX@/@INSTALL_INCLUDE_DIR_BASE@"; else if(op.key()=="cxx") output += "@CMAKE_CXX_COMPILER@"; else if(op.key()=="features") - output += FEATURES; + output += OPTIONAL_DEPENDENCIES; else if(op.key()=="version") output += "@PROJECT_VERSION@"; else if(op.key()=="revision") output += "@PROJECT_GIT_REVISION@"; output += ' '; } if(!output.empty()) { assert(output.back() == ' '); output.pop_back(); } std::cout << output << std::endl; } catch(cxxopts::OptionException const &) { std::cout << options.help(); } return EXIT_SUCCESS; }