QtAutogen: Move initialization condition to caller.
This commit is contained in:
parent
9470b056fc
commit
8b6ec29d40
@ -1436,6 +1436,18 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// don't do anything if there is no Qt4 or Qt5Core (which contains moc):
|
||||||
|
cmMakefile* mf = ti->second.GetMakefile();
|
||||||
|
std::string qtMajorVersion = mf->GetSafeDefinition("QT_VERSION_MAJOR");
|
||||||
|
if (qtMajorVersion == "")
|
||||||
|
{
|
||||||
|
qtMajorVersion = mf->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
|
||||||
|
}
|
||||||
|
if (qtMajorVersion != "4" && qtMajorVersion != "5")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
targetNames.push_back(ti->second.GetName());
|
targetNames.push_back(ti->second.GetName());
|
||||||
}
|
}
|
||||||
for(std::vector<std::string>::iterator ti = targetNames.begin();
|
for(std::vector<std::string>::iterator ti = targetNames.begin();
|
||||||
@ -1444,12 +1456,10 @@ void cmGlobalGenerator::CreateQtAutoGeneratorsTargets(AutogensType &autogens)
|
|||||||
cmTarget& target = *this->LocalGenerators[i]
|
cmTarget& target = *this->LocalGenerators[i]
|
||||||
->GetMakefile()->FindTarget(*ti, true);
|
->GetMakefile()->FindTarget(*ti, true);
|
||||||
|
|
||||||
if(cmQtAutoGenerators::InitializeAutogenTarget(
|
cmQtAutoGenerators::InitializeAutogenTarget(
|
||||||
this->LocalGenerators[i], &target))
|
this->LocalGenerators[i], &target);
|
||||||
{
|
cmQtAutoGenerators autogen;
|
||||||
cmQtAutoGenerators autogen;
|
autogens.push_back(std::make_pair(autogen, &target));
|
||||||
autogens.push_back(std::make_pair(autogen, &target));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -286,20 +286,10 @@ std::string cmQtAutoGenerators::ListQt4RccInputs(cmSourceFile* sf,
|
|||||||
return entriesList;
|
return entriesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
|
void cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
|
||||||
cmTarget* target)
|
cmTarget* target)
|
||||||
{
|
{
|
||||||
cmMakefile* makefile = target->GetMakefile();
|
cmMakefile* makefile = target->GetMakefile();
|
||||||
// don't do anything if there is no Qt4 or Qt5Core (which contains moc):
|
|
||||||
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
|
|
||||||
if (qtMajorVersion == "")
|
|
||||||
{
|
|
||||||
qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
|
|
||||||
}
|
|
||||||
if (qtMajorVersion != "4" && qtMajorVersion != "5")
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target->GetPropertyAsBool("AUTOMOC"))
|
if (target->GetPropertyAsBool("AUTOMOC"))
|
||||||
{
|
{
|
||||||
@ -499,8 +489,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg,
|
|||||||
|
|
||||||
target->AddUtility(autogenTargetName);
|
target->AddUtility(autogenTargetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
|
static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
cmQtAutoGenerators();
|
cmQtAutoGenerators();
|
||||||
bool Run(const std::string& targetDirectory, const std::string& config);
|
bool Run(const std::string& targetDirectory, const std::string& config);
|
||||||
|
|
||||||
static bool InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
|
static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
|
||||||
static void SetupAutoGenerateTarget(cmTarget const* target);
|
static void SetupAutoGenerateTarget(cmTarget const* target);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user