summaryrefslogtreecommitdiffstats
path: root/Source/cmMakefileTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-03-10 19:47:19 (GMT)
committerBrad King <brad.king@kitware.com>2014-03-12 14:44:01 (GMT)
commitbc993f277ebd44fabe8312a85c5682eed011336d (patch)
tree3f385f5257072c0eb18aa64badfe282eb41e3996 /Source/cmMakefileTargetGenerator.cxx
parent9a5c55441418ef79415b9a1b99c35192d2b8c1b0 (diff)
downloadCMake-bc993f277ebd44fabe8312a85c5682eed011336d.zip
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.gz
CMake-bc993f277ebd44fabe8312a85c5682eed011336d.tar.bz2
Generalize cmCustomCommandGenerator to more fields
Until now the cmCustomCommandGenerator was used only to compute the command lines of a custom command. Generalize it to get the comment, working directory, dependencies, and outputs of custom commands. Update use in all generators to support this.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r--Source/cmMakefileTargetGenerator.cxx28
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index 983fd99..3161aba 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -21,6 +21,7 @@
#include "cmTarget.h"
#include "cmake.h"
#include "cmComputeLinkInformation.h"
+#include "cmCustomCommandGenerator.h"
#include "cmGeneratorExpression.h"
#include "cmMakefileExecutableTargetGenerator.h"
@@ -158,11 +159,13 @@ void cmMakefileTargetGenerator::WriteTargetBuildRules()
si = customCommands.begin();
si != customCommands.end(); ++si)
{
- cmCustomCommand const* cc = (*si)->GetCustomCommand();
- this->GenerateCustomRuleFile(*cc);
+ cmCustomCommandGenerator ccg(*(*si)->GetCustomCommand(),
+ this->ConfigName,
+ this->Makefile);
+ this->GenerateCustomRuleFile(ccg);
if (clean)
{
- const std::vector<std::string>& outputs = cc->GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
for(std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o)
{
@@ -1178,7 +1181,8 @@ cmMakefileTargetGenerator
{
if(cmCustomCommand* cc = (*source)->GetCustomCommand())
{
- const std::vector<std::string>& outputs = cc->GetOutputs();
+ cmCustomCommandGenerator ccg(*cc, this->ConfigName, this->Makefile);
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
for(std::vector<std::string>::const_iterator o = outputs.begin();
o != outputs.end(); ++o)
{
@@ -1210,11 +1214,11 @@ void cmMakefileTargetGenerator
//----------------------------------------------------------------------------
void cmMakefileTargetGenerator
-::GenerateCustomRuleFile(const cmCustomCommand& cc)
+::GenerateCustomRuleFile(cmCustomCommandGenerator const& ccg)
{
// Collect the commands.
std::vector<std::string> commands;
- std::string comment = this->LocalGenerator->ConstructComment(cc);
+ std::string comment = this->LocalGenerator->ConstructComment(ccg);
if(!comment.empty())
{
// add in a progress call if needed
@@ -1229,19 +1233,19 @@ void cmMakefileTargetGenerator
// Now append the actual user-specified commands.
cmOStringStream content;
- this->LocalGenerator->AppendCustomCommand(commands, cc, this->Target, false,
+ this->LocalGenerator->AppendCustomCommand(commands, ccg, this->Target, false,
cmLocalGenerator::HOME_OUTPUT,
&content);
// Collect the dependencies.
std::vector<std::string> depends;
- this->LocalGenerator->AppendCustomDepend(depends, cc);
+ this->LocalGenerator->AppendCustomDepend(depends, ccg);
// Check whether we need to bother checking for a symbolic output.
bool need_symbolic = this->GlobalGenerator->GetNeedSymbolicMark();
// Write the rule.
- const std::vector<std::string>& outputs = cc.GetOutputs();
+ const std::vector<std::string>& outputs = ccg.GetOutputs();
std::vector<std::string>::const_iterator o = outputs.begin();
{
bool symbolic = false;
@@ -1259,7 +1263,7 @@ void cmMakefileTargetGenerator
// If the rule has changed make sure the output is rebuilt.
if(!symbolic)
{
- this->GlobalGenerator->AddRuleHash(cc.GetOutputs(), content.str());
+ this->GlobalGenerator->AddRuleHash(ccg.GetOutputs(), content.str());
}
}
@@ -1280,8 +1284,8 @@ void cmMakefileTargetGenerator
// Setup implicit dependency scanning.
for(cmCustomCommand::ImplicitDependsList::const_iterator
- idi = cc.GetImplicitDepends().begin();
- idi != cc.GetImplicitDepends().end(); ++idi)
+ idi = ccg.GetCC().GetImplicitDepends().begin();
+ idi != ccg.GetCC().GetImplicitDepends().end(); ++idi)
{
std::string objFullPath =
this->Convert(outputs[0], cmLocalGenerator::FULL);