diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-05-27 18:53:51 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-05-27 18:56:07 (GMT) |
commit | f77631672168b1e3b5fad93c2bb83db65cb67e7b (patch) | |
tree | 896242c1aff49eceed103bab6afc283ee193f0f6 /Source/cmQtAutomoc.cxx | |
parent | ab7cd03cea8651fa1aea9c109fabc69b4e247062 (diff) | |
download | CMake-f77631672168b1e3b5fad93c2bb83db65cb67e7b.zip CMake-f77631672168b1e3b5fad93c2bb83db65cb67e7b.tar.gz CMake-f77631672168b1e3b5fad93c2bb83db65cb67e7b.tar.bz2 |
Use the qt5::moc imported target instead of a variable.
The variable is provided in the Qt5 config files only for compatibility
with this automoc feature, so use the more-future-proof method instead.
Diffstat (limited to 'Source/cmQtAutomoc.cxx')
-rw-r--r-- | Source/cmQtAutomoc.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx index a468fa7..9d14fc2 100644 --- a/Source/cmQtAutomoc.cxx +++ b/Source/cmQtAutomoc.cxx @@ -309,6 +309,23 @@ 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")) + { + 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 + { + const char *qtMoc = makefile->GetSafeDefinition("QT_MOC_EXECUTABLE"); + makefile->AddDefinition("_qt_moc_executable", qtMoc); + } + const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT"); std::string inputFile = cmakeRoot; inputFile += "/Modules/AutomocInfo.cmake.in"; |