Merge topic 'automoc_qt5'
bafe5cc Fix style. 74b9392 Update comments and method names to not be Qt4 specific. 812dab0 Don't assume the existence of QT_MAJOR_VERSION.
This commit is contained in:
commit
1e055d374e
@ -11,4 +11,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@")
|
||||||
|
@ -49,8 +49,12 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
|
|||||||
{
|
{
|
||||||
cmMakefile* makefile = target->GetMakefile();
|
cmMakefile* makefile = target->GetMakefile();
|
||||||
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 or Qt5SrcTools (which contains moc):
|
||||||
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;
|
||||||
@ -179,7 +183,7 @@ bool cmQtAutomoc::Run(const char* targetDirectory)
|
|||||||
|
|
||||||
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
|
if (this->QtMajorVersion == "4" || this->QtMajorVersion == "5")
|
||||||
{
|
{
|
||||||
this->RunAutomocQt4();
|
this->RunAutomoc();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->WriteOldMocDefinitionsFile(targetDirectory);
|
this->WriteOldMocDefinitionsFile(targetDirectory);
|
||||||
@ -222,6 +226,11 @@ 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(
|
||||||
@ -382,7 +391,7 @@ void cmQtAutomoc::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool cmQtAutomoc::RunAutomocQt4()
|
bool cmQtAutomoc::RunAutomoc()
|
||||||
{
|
{
|
||||||
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
|
if (!cmsys::SystemTools::FileExists(this->OutMocCppFilename.c_str())
|
||||||
|| (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
|
|| (this->OldMocDefinitionsStr != this->Join(this->MocDefinitions, ' ')))
|
||||||
|
@ -35,7 +35,7 @@ private:
|
|||||||
const char* targetDirectory);
|
const char* targetDirectory);
|
||||||
void WriteOldMocDefinitionsFile(const char* targetDirectory);
|
void WriteOldMocDefinitionsFile(const char* targetDirectory);
|
||||||
|
|
||||||
bool RunAutomocQt4();
|
bool RunAutomoc();
|
||||||
bool GenerateMoc(const std::string& sourceFile,
|
bool GenerateMoc(const std::string& sourceFile,
|
||||||
const std::string& mocFileName);
|
const std::string& mocFileName);
|
||||||
void ParseCppFile(const std::string& absFilename,
|
void ParseCppFile(const std::string& absFilename,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user