summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-03 13:57:01 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-06-03 13:57:01 (GMT)
commit6d4e79e2c361084ae26a8961ac9936052d68fde9 (patch)
tree574a61a9c45764f2e1d267ec09f8d38454c9b6a8 /Source
parent3caf565d079af73f0ea8aaa7b6f4f212e0fcb15d (diff)
parentfa55751f83dc5d5bd5f80d12c3076ec703262edb (diff)
downloadCMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.zip
CMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.tar.gz
CMake-6d4e79e2c361084ae26a8961ac9936052d68fde9.tar.bz2
Merge topic 'qt4-qt5-CMAKE_AUTOMOC'
fa55751 QtAutomoc: Get the Qt version through the target link interface f776316 Use the qt5::moc imported target instead of a variable.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutomoc.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index a468fa7..350b462 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -309,6 +309,46 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
+ 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)
+ {
+ cmSystemTools::Error("Qt5::moc target not found ",
+ automocTargetName.c_str());
+ return;
+ }
+ makefile->AddDefinition("_qt_moc_executable", qt5Moc->GetLocation(0));
+ }
+ else
+ {
+ 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");
std::string inputFile = cmakeRoot;
inputFile += "/Modules/AutomocInfo.cmake.in";