diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2019-01-14 16:33:03 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2019-01-15 08:52:35 (GMT) |
commit | f2f166133402ad5f7998e0fef93b04f56c2f6d07 (patch) | |
tree | 9df2037b372763877f19f7b54792dbc7c927396c /Source | |
parent | b2343ff08682e23f61be27c4faf02f8e2c37abcf (diff) | |
download | CMake-f2f166133402ad5f7998e0fef93b04f56c2f6d07.zip CMake-f2f166133402ad5f7998e0fef93b04f56c2f6d07.tar.gz CMake-f2f166133402ad5f7998e0fef93b04f56c2f6d07.tar.bz2 |
Autogen: Add and use QtAutoGen::Tools method
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGen.cxx | 35 | ||||
-rw-r--r-- | Source/cmQtAutoGen.h | 3 | ||||
-rw-r--r-- | Source/cmQtAutoGenGlobalInitializer.cxx | 14 |
3 files changed, 39 insertions, 13 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"; |