|
|
@@ -309,7 +309,27 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
|
|
cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
|
|
|
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
|
|
|
|
|
|
- if (makefile->GetDefinition("Qt5Core_VERSION_MAJOR"))
|
|
|
+ const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
|
|
|
+ if (!qtVersion)
|
|
|
+ {
|
|
|
+ qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
|
|
|
+ }
|
|
|
+ if (const char *targetQtVersion =
|
|
|
+ target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
|
|
|
+ {
|
|
|
+ qtVersion = targetQtVersion;
|
|
|
+ }
|
|
|
+ if (qtVersion)
|
|
|
+ {
|
|
|
+ makefile->AddDefinition("_target_qt_version", qtVersion);
|
|
|
+ }
|
|
|
+
|
|
|
+ {
|
|
|
+ const char *qtMoc = makefile->GetSafeDefinition("QT_MOC_EXECUTABLE");
|
|
|
+ makefile->AddDefinition("_qt_moc_executable", qtMoc);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strcmp(qtVersion, "5") == 0)
|
|
|
{
|
|
|
cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc");
|
|
|
if (!qt5Moc)
|
|
|
@@ -322,8 +342,11 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- const char *qtMoc = makefile->GetSafeDefinition("QT_MOC_EXECUTABLE");
|
|
|
- makefile->AddDefinition("_qt_moc_executable", qtMoc);
|
|
|
+ if (strcmp(qtVersion, "4") != 0)
|
|
|
+ {
|
|
|
+ cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and "
|
|
|
+ "Qt 5 ", automocTargetName.c_str());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
|