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.
This commit is contained in:
parent
ab7cd03cea
commit
f776316721
|
@ -6,7 +6,7 @@ set(AM_MOC_OPTIONS @_moc_options@)
|
||||||
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
set(AM_CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE "@CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE@")
|
||||||
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
|
set(AM_CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@/")
|
||||||
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
|
set(AM_CMAKE_SOURCE_DIR "@CMAKE_SOURCE_DIR@/")
|
||||||
set(AM_QT_MOC_EXECUTABLE "@QT_MOC_EXECUTABLE@")
|
set(AM_QT_MOC_EXECUTABLE "@_qt_moc_executable@")
|
||||||
set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
|
set(AM_CMAKE_CURRENT_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@/")
|
||||||
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
|
set(AM_CMAKE_CURRENT_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/")
|
||||||
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
set(AM_QT_VERSION_MAJOR "@QT_VERSION_MAJOR@" )
|
||||||
|
|
|
@ -309,6 +309,23 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
||||||
cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
|
cmLocalGenerator::EscapeForCMake(_moc_headers.c_str()).c_str());
|
||||||
makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
|
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");
|
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
|
||||||
std::string inputFile = cmakeRoot;
|
std::string inputFile = cmakeRoot;
|
||||||
inputFile += "/Modules/AutomocInfo.cmake.in";
|
inputFile += "/Modules/AutomocInfo.cmake.in";
|
||||||
|
|
Loading…
Reference in New Issue