summaryrefslogtreecommitdiffstats
path: root/Source/cmQtAutoGenerators.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r--Source/cmQtAutoGenerators.cxx58
1 files changed, 36 insertions, 22 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index da22ab5..2987c25 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -549,9 +549,6 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
}
}
- const char *qtMoc = makefile->GetSafeDefinition("QT_MOC_EXECUTABLE");
- makefile->AddDefinition("_qt_moc_executable", qtMoc);
-
const char *qtVersion = makefile->GetDefinition("_target_qt_version");
if (strcmp(qtVersion, "5") == 0)
{
@@ -564,13 +561,21 @@ void cmQtAutoGenerators::SetupAutoMocTarget(cmTarget const* target,
}
makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0));
}
- else
+ else if (strcmp(qtVersion, "4") == 0)
{
- if (strcmp(qtVersion, "4") != 0)
+ cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc");
+ if (!qt4Moc)
{
- cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and "
- "Qt 5 ", autogenTargetName.c_str());
+ cmSystemTools::Error("Qt4::moc target not found ",
+ autogenTargetName.c_str());
+ return;
}
+ makefile->AddDefinition("_qt_moc_executable", qt4Moc->GetLocation(0));
+ }
+ else
+ {
+ cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and "
+ "Qt 5 ", autogenTargetName.c_str());
}
}
@@ -641,9 +646,6 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
{
cmMakefile *makefile = target->GetMakefile();
- const char *qtUic = makefile->GetSafeDefinition("QT_UIC_EXECUTABLE");
- makefile->AddDefinition("_qt_uic_executable", qtUic);
-
std::vector<cmSourceFile*> srcFiles;
target->GetSourceFiles(srcFiles);
@@ -747,20 +749,27 @@ void cmQtAutoGenerators::SetupAutoUicTarget(cmTarget const* target,
if (!qt5Uic)
{
// Project does not use Qt5Widgets, but has AUTOUIC ON anyway
- makefile->RemoveDefinition("_qt_uic_executable");
}
else
{
makefile->AddDefinition("_qt_uic_executable", qt5Uic->GetLocation(0));
}
}
- else
+ else if (strcmp(qtVersion, "4") == 0)
{
- if (strcmp(qtVersion, "4") != 0)
+ cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic");
+ if (!qt4Uic)
{
- cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and "
- "Qt 5 ", targetName);
+ cmSystemTools::Error("Qt4::uic target not found ",
+ targetName);
+ return;
}
+ makefile->AddDefinition("_qt_uic_executable", qt4Uic->GetLocation(0));
+ }
+ else
+ {
+ cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and "
+ "Qt 5 ", targetName);
}
}
@@ -927,9 +936,6 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
makefile->AddDefinition("_qt_rcc_options_options",
cmLocalGenerator::EscapeForCMake(rccFileOptions.c_str()).c_str());
- const char *qtRcc = makefile->GetSafeDefinition("QT_RCC_EXECUTABLE");
- makefile->AddDefinition("_qt_rcc_executable", qtRcc);
-
const char* targetName = target->GetName();
if (strcmp(qtVersion, "5") == 0)
{
@@ -942,13 +948,21 @@ void cmQtAutoGenerators::SetupAutoRccTarget(cmTarget const* target)
}
makefile->AddDefinition("_qt_rcc_executable", qt5Rcc->GetLocation(0));
}
- else
+ else if (strcmp(qtVersion, "4") == 0)
{
- if (strcmp(qtVersion, "4") != 0)
+ cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc");
+ if (!qt4Rcc)
{
- cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "
- "Qt 5 ", targetName);
+ cmSystemTools::Error("Qt4::rcc target not found ",
+ targetName);
+ return;
}
+ makefile->AddDefinition("_qt_rcc_executable", qt4Rcc->GetLocation(0));
+ }
+ else
+ {
+ cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "
+ "Qt 5 ", targetName);
}
}