summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2019-01-10 16:39:51 (GMT)
committerBrad King <brad.king@kitware.com>2019-01-10 19:05:33 (GMT)
commitf44a0414aec38f6e70eb2c11c75c9f35bb526259 (patch)
treec54c947b5114b0ab4f6ae688b0ac706026fc95fa /Source
parent6092a770f66bff959749170141d44188f4b6f3f1 (diff)
downloadCMake-f44a0414aec38f6e70eb2c11c75c9f35bb526259.zip
CMake-f44a0414aec38f6e70eb2c11c75c9f35bb526259.tar.gz
CMake-f44a0414aec38f6e70eb2c11c75c9f35bb526259.tar.bz2
Autogen: Issue a warning when AUTOMOC/UIC/RCC gets disabled.
We used to silently disable AUTOMOC/UIC/RCC when no valid Qt version was found. This patch introduces the generation of a warning message in that case.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenGlobalInitializer.cxx40
1 files changed, 37 insertions, 3 deletions
diff --git a/Source/cmQtAutoGenGlobalInitializer.cxx b/Source/cmQtAutoGenGlobalInitializer.cxx
index 678ff14..f4cf3e0 100644
--- a/Source/cmQtAutoGenGlobalInitializer.cxx
+++ b/Source/cmQtAutoGenGlobalInitializer.cxx
@@ -13,6 +13,7 @@
#include "cmStateTypes.h"
#include "cmSystemTools.h"
#include "cmTarget.h"
+#include "cmake.h"
#include <memory>
#include <utility>
@@ -86,10 +87,43 @@ cmQtAutoGenGlobalInitializer::cmQtAutoGenGlobalInitializer(
auto qtVersion = cmQtAutoGenInitializer::GetQtVersion(target);
bool const validQt = (qtVersion.Major == 4) ||
(qtVersion.Major == 5) || (qtVersion.Major == 6);
- bool const mocIsValid = moc && (validQt || !mocExec.empty());
- bool const uicIsValid = uic && (validQt || !uicExec.empty());
- bool const rccIsValid = rcc && (validQt || !rccExec.empty());
+ bool const mocAvailable = (validQt || !mocExec.empty());
+ bool const uicAvailable = (validQt || !uicExec.empty());
+ bool const rccAvailable = (validQt || !rccExec.empty());
+ bool const mocIsValid = (moc && mocAvailable);
+ bool const uicIsValid = (uic && uicAvailable);
+ bool const rccIsValid = (rcc && uicAvailable);
+ // Disabled AUTOMOC/UIC/RCC warning
+ bool const mocDisabled = (moc && !mocAvailable);
+ bool const uicDisabled = (uic && !uicAvailable);
+ bool const rccDisabled = (rcc && !rccAvailable);
+ if (mocDisabled || uicDisabled || rccDisabled) {
+ 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 += " disabled. Consider adding:\n";
+ if (uicDisabled) {
+ msg += " find_package(Qt5 COMPONENTS Widgets)\n";
+ } else {
+ msg += " find_package(Qt5 COMPONENTS Core)\n";
+ }
+ msg += "to your CMakeLists.txt file.";
+ target->Makefile->IssueMessage(cmake::AUTHOR_WARNING, msg);
+ }
if (mocIsValid || uicIsValid || rccIsValid) {
// Create autogen target initializer
Initializers_.emplace_back(cm::make_unique<cmQtAutoGenInitializer>(