Move some makefile definitions up away from moc-specific code.
This commit is contained in:
parent
98632effeb
commit
a342c9ffed
|
@ -206,10 +206,31 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
|
|||
cmMakefile* makefile = target->GetMakefile();
|
||||
const char* targetName = target->GetName();
|
||||
|
||||
// forget the variables added here afterwards again:
|
||||
cmMakefile::ScopePushPop varScope(makefile);
|
||||
static_cast<void>(varScope);
|
||||
|
||||
const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
|
||||
if (!qtVersion)
|
||||
{
|
||||
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
|
||||
}
|
||||
if (const char *targetQtVersion =
|
||||
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
|
||||
{
|
||||
qtVersion = targetQtVersion;
|
||||
}
|
||||
if (qtVersion)
|
||||
{
|
||||
makefile->AddDefinition("_target_qt_version", qtVersion);
|
||||
}
|
||||
// create a custom target for running generators at buildtime:
|
||||
std::string autogenTargetName = targetName;
|
||||
autogenTargetName += "_automoc";
|
||||
|
||||
makefile->AddDefinition("_moc_target_name",
|
||||
cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
|
||||
|
||||
std::string targetDir = makefile->GetCurrentOutputDirectory();
|
||||
targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
|
||||
targetDir += "/";
|
||||
|
@ -329,13 +350,6 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
|
|||
|
||||
const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
|
||||
std::string _moc_options = (tmp!=0 ? tmp : "");
|
||||
|
||||
// forget the variables added here afterwards again:
|
||||
cmMakefile::ScopePushPop varScope(makefile);
|
||||
static_cast<void>(varScope);
|
||||
|
||||
makefile->AddDefinition("_moc_target_name",
|
||||
cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
|
||||
makefile->AddDefinition("_moc_options",
|
||||
cmLocalGenerator::EscapeForCMake(_moc_options.c_str()).c_str());
|
||||
makefile->AddDefinition("_moc_files",
|
||||
|
@ -388,21 +402,6 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
|
|||
}
|
||||
}
|
||||
|
||||
const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
|
||||
if (!qtVersion)
|
||||
{
|
||||
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
|
||||
}
|
||||
if (const char *targetQtVersion =
|
||||
target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", 0))
|
||||
{
|
||||
qtVersion = targetQtVersion;
|
||||
}
|
||||
if (qtVersion)
|
||||
{
|
||||
makefile->AddDefinition("_target_qt_version", qtVersion);
|
||||
}
|
||||
|
||||
{
|
||||
const char *qtMoc = makefile->GetSafeDefinition("QT_MOC_EXECUTABLE");
|
||||
makefile->AddDefinition("_qt_moc_executable", qtMoc);
|
||||
|
|
Loading…
Reference in New Issue