Don't assume the existence of QT_MAJOR_VERSION.

Also handle Qt5SrcTools_MAJOR_VERSION.
This commit is contained in:
Stephen Kelly 2011-11-09 23:17:20 +01:00
parent c208ab8d5c
commit 812dab067e
2 changed files with 9 additions and 0 deletions

View File

@ -10,4 +10,5 @@ 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@" )
set(AM_Qt5SrcTools_VERSION_MAJOR "@Qt5SrcTools_VERSION_MAJOR@" )
set(AM_TARGET_NAME "@_moc_target_name@") set(AM_TARGET_NAME "@_moc_target_name@")

View File

@ -51,6 +51,10 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
const char* targetName = target->GetName(); const char* targetName = target->GetName();
// don't do anything if there is no Qt4: // don't do anything if there is no Qt4:
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR"); std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
if (qtMajorVersion == "")
{
qtMajorVersion = makefile->GetSafeDefinition("Qt5SrcTools_VERSION_MAJOR");
}
if (qtMajorVersion != "4" && qtMajorVersion != "5") if (qtMajorVersion != "4" && qtMajorVersion != "5")
{ {
return; return;
@ -215,6 +219,10 @@ bool cmQtAutomoc::ReadAutomocInfoFile(cmMakefile* makefile,
} }
this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR"); this->QtMajorVersion = makefile->GetSafeDefinition("AM_QT_VERSION_MAJOR");
if (this->QtMajorVersion == "")
{
this->QtMajorVersion = makefile->GetSafeDefinition("AM_Qt5SrcTools_VERSION_MAJOR");
}
this->Sources = makefile->GetSafeDefinition("AM_SOURCES"); this->Sources = makefile->GetSafeDefinition("AM_SOURCES");
this->Headers = makefile->GetSafeDefinition("AM_HEADERS"); this->Headers = makefile->GetSafeDefinition("AM_HEADERS");
this->IncludeProjectDirsBefore = makefile->IsOn( this->IncludeProjectDirsBefore = makefile->IsOn(