diff options
author | Stephen Kelly <steveire@gmail.com> | 2013-10-11 12:26:54 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2013-10-24 09:50:57 (GMT) |
commit | a342c9ffedb865919b7a13b5620caecbb5076865 (patch) | |
tree | 1294c61e22e1ddc516e77f52c26dc6546766be9a | |
parent | 98632effebc7ed59105a67c549989265a3b207f1 (diff) | |
download | CMake-a342c9ffedb865919b7a13b5620caecbb5076865.zip CMake-a342c9ffedb865919b7a13b5620caecbb5076865.tar.gz CMake-a342c9ffedb865919b7a13b5620caecbb5076865.tar.bz2 |
Move some makefile definitions up away from moc-specific code.
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 3d915dd..5fbdb83 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -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); |