diff options
-rw-r--r-- | Source/cmQtAutoGen.cxx | 35 | ||||
-rw-r--r-- | Source/cmQtAutoGen.h | 3 | ||||
-rw-r--r-- | Source/cmQtAutoGenGlobalInitializer.cxx | 14 | ||||
-rw-r--r-- | Tests/RunCMake/Autogen/NoQt-stderr.txt | 2 |
4 files changed, 40 insertions, 14 deletions
diff --git a/Source/cmQtAutoGen.cxx b/Source/cmQtAutoGen.cxx index 000529d..9dc5fa8 100644 --- a/Source/cmQtAutoGen.cxx +++ b/Source/cmQtAutoGen.cxx @@ -99,6 +99,41 @@ std::string cmQtAutoGen::GeneratorNameUpper(GeneratorT genType) return cmSystemTools::UpperCase(cmQtAutoGen::GeneratorName(genType)); } +std::string cmQtAutoGen::Tools(bool moc, bool uic, bool rcc) +{ + std::string res; + std::vector<std::string> lst; + if (moc) { + lst.emplace_back("AUTOMOC"); + } + if (uic) { + lst.emplace_back("AUTOUIC"); + } + if (rcc) { + lst.emplace_back("AUTORCC"); + } + switch (lst.size()) { + case 1: + res += lst.at(0); + break; + case 2: + res += lst.at(0); + res += " and "; + res += lst.at(1); + break; + case 3: + res += lst.at(0); + res += ", "; + res += lst.at(1); + res += " and "; + res += lst.at(2); + break; + default: + break; + } + return res; +} + std::string cmQtAutoGen::Quoted(std::string const& text) { static const char* rep[18] = { "\\", "\\\\", "\"", "\\\"", "\a", "\\a", diff --git a/Source/cmQtAutoGen.h b/Source/cmQtAutoGen.h index 4118dc7..96d1946 100644 --- a/Source/cmQtAutoGen.h +++ b/Source/cmQtAutoGen.h @@ -60,6 +60,9 @@ public: /// @brief Returns the generator name in upper case static std::string GeneratorNameUpper(GeneratorT genType); + /// @brief Returns a string with the requested tool names + static std::string Tools(bool moc, bool uic, bool rcc); + /// @brief Returns the string escaped and enclosed in quotes static std::string Quoted(std::string const& text); diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx index d1cbd0d..a5a8423 100644 --- a/Source/cmQtAutoGenGlobalInitializer.cxx +++ b/Source/cmQtAutoGenGlobalInitializer.cxx @@ -102,19 +102,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer( std::string msg = "AUTOGEN: No valid Qt version found for target "; msg += target->GetName(); msg += ". "; - { - std::vector<std::string> lst; - if (mocDisabled) { - lst.emplace_back("AUTOMOC"); - } - if (uicDisabled) { - lst.emplace_back("AUTOUIC"); - } - if (rccDisabled) { - lst.emplace_back("AUTORCC"); - } - msg += cmJoin(lst, ", "); - } + msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled); msg += " disabled. Consider adding:\n"; if (uicDisabled) { msg += " find_package(Qt5 COMPONENTS Widgets)\n"; diff --git a/Tests/RunCMake/Autogen/NoQt-stderr.txt b/Tests/RunCMake/Autogen/NoQt-stderr.txt index 6b4a933..66b6cae 100644 --- a/Tests/RunCMake/Autogen/NoQt-stderr.txt +++ b/Tests/RunCMake/Autogen/NoQt-stderr.txt @@ -1,5 +1,5 @@ ^CMake Warning \(dev\) in CMakeLists.txt: - AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC, + AUTOGEN: No valid Qt version found for target main. AUTOMOC, AUTOUIC and AUTORCC disabled. Consider adding: find_package\(Qt5 COMPONENTS Widgets\) |