summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenGlobalInitializer.cxx
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-01-14 17:32:17 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2019-01-15 09:15:03 (GMT)
commit5fe18eee1392c312612fad0e6f408ea7cb1ef29d (patch)
tree7ba19ab63a68562416c17c3e6eec76ac89dd4582 /Source/cmQtAutoGenGlobalInitializer.cxx
parentf2f166133402ad5f7998e0fef93b04f56c2f6d07 (diff)
downloadCMake-5fe18eee1392c312612fad0e6f408ea7cb1ef29d.zip
CMake-5fe18eee1392c312612fad0e6f408ea7cb1ef29d.tar.gz
CMake-5fe18eee1392c312612fad0e6f408ea7cb1ef29d.tar.bz2
Autogen: Adaptive missing Qt warning
This makes the warning message for a missing Qt use the requested Qt version in the message text.
Diffstat (limited to 'Source/cmQtAutoGenGlobalInitializer.cxx')
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx20
1 files changed, 13 insertions, 7 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index a5a8423..0b1995d 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -85,8 +85,8 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
// We support Qt4, Qt5 and Qt6
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
- bool const validQt = (qtVersion.Major == 4) ||
- (qtVersion.Major == 5) || (qtVersion.Major == 6);
+ bool const validQt = (qtVersion.first.Major == 4) ||
+ (qtVersion.first.Major == 5) || (qtVersion.first.Major == 6);
bool const mocAvailable = (validQt || !mocExec.empty());
bool const uicAvailable = (validQt || !uicExec.empty());
@@ -104,10 +104,16 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
msg += ". ";
msg += cmQtAutoGen::Tools(mocDisabled, uicDisabled, rccDisabled);
msg += " disabled. Consider adding:\n";
- if (uicDisabled) {
- msg += " find_package(Qt5 COMPONENTS Widgets)\n";
- } else {
- msg += " find_package(Qt5 COMPONENTS Core)\n";
+ {
+ std::string version = (qtVersion.second == 0)
+ ? std::string("<QTVERSION>")
+ : std::to_string(qtVersion.second);
+ std::string comp = uicDisabled ? "Widgets" : "Core";
+ msg += " find_package(Qt";
+ msg += version;
+ msg += " COMPONENTS ";
+ msg += comp;
+ msg += ")\n";
}
msg += "to your CMakeLists.txt file.";
target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
@@ -115,7 +121,7 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
if (mocIsValid || uicIsValid || rccIsValid) {
// Create autogen target initializer
Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(
- this, target, qtVersion, mocIsValid, uicIsValid, rccIsValid,
+ this, target, qtVersion.first, mocIsValid, uicIsValid, rccIsValid,
globalAutoGenTarget, globalAutoRccTarget));
}
}