summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2013-11-04 09:25:08 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-11-05 19:17:30 (GMT)
commit20a234d1b8d41852bdf401ee6484b1d0e877c7c4 (patch)
treebecec390d6a4ea62d694ef4bef9834b3e2241627 /Source
parente313d397cd621960c57a2231b1eceeac72f20ac7 (diff)
downloadCMake-20a234d1b8d41852bdf401ee6484b1d0e877c7c4.zip
CMake-20a234d1b8d41852bdf401ee6484b1d0e877c7c4.tar.gz
CMake-20a234d1b8d41852bdf401ee6484b1d0e877c7c4.tar.bz2
cmAutogen: Extract some helper methods for autogen targets.
These snippets will soon be needed from multiple methods.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenerators.cxx30
1 files changed, 21 insertions, 9 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 5f7a26f..dcd0300 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -138,6 +138,24 @@ cmQtAutoGenerators::cmQtAutoGenerators()
}
}
+static std::string getAutogenTargetName(cmTarget *target)
+{
+ std::string autogenTargetName = target->GetName();
+ autogenTargetName += "_automoc";
+ return autogenTargetName;
+}
+
+static std::string getAutogenTargetDir(cmTarget *target)
+{
+ cmMakefile* makefile = target->GetMakefile();
+ std::string targetDir = makefile->GetCurrentOutputDirectory();
+ targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
+ targetDir += "/";
+ targetDir += getAutogenTargetName(target);
+ targetDir += ".dir/";
+ return targetDir;
+}
+
bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
{
cmMakefile* makefile = target->GetMakefile();
@@ -154,8 +172,7 @@ bool cmQtAutoGenerators::InitializeMocSourceFile(cmTarget* target)
if (target->GetPropertyAsBool("AUTOMOC"))
{
- std::string automocTargetName = target->GetName();
- automocTargetName += "_automoc";
+ std::string automocTargetName = getAutogenTargetName(target);
std::string mocCppFile = makefile->GetCurrentOutputDirectory();
mocCppFile += "/";
mocCppFile += automocTargetName;
@@ -232,17 +249,12 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget* target)
makefile->AddDefinition("_target_qt_version", qtVersion);
}
// create a custom target for running generators at buildtime:
- std::string autogenTargetName = targetName;
- autogenTargetName += "_automoc";
+ std::string autogenTargetName = getAutogenTargetName(target);
makefile->AddDefinition("_moc_target_name",
cmLocalGenerator::EscapeForCMake(autogenTargetName.c_str()).c_str());
- std::string targetDir = makefile->GetCurrentOutputDirectory();
- targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
- targetDir += "/";
- targetDir += autogenTargetName;
- targetDir += ".dir/";
+ std::string targetDir = getAutogenTargetDir(target);
cmCustomCommandLine currentLine;
currentLine.push_back(makefile->GetSafeDefinition("CMAKE_COMMAND"));