summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmGlobalGenerator.cxx2
-rw-r--r--Source/cmMakefile.cxx6
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx2
-rw-r--r--Source/cmQtAutoGenerators.cxx2
-rw-r--r--Source/cmTarget.h12
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx6
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h3
7 files changed, 20 insertions, 13 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 65a7118..a160336 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2407,7 +2407,7 @@ cmTarget cmGlobalGenerator::CreateGlobalTarget(
// Store the custom command in the target.
cmCustomCommand cc(0, no_outputs, no_depends, *commandLines, 0,
workingDirectory);
- target.GetPostBuildCommands().push_back(cc);
+ target.AddPostBuildCommand(cc);
target.SetProperty("EchoString", message);
std::vector<std::string>::iterator dit;
for ( dit = depends.begin(); dit != depends.end(); ++ dit )
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ac8381c..4a2153d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -903,13 +903,13 @@ cmMakefile::AddCustomCommandToTarget(const char* target,
switch(type)
{
case cmTarget::PRE_BUILD:
- ti->second.GetPreBuildCommands().push_back(cc);
+ ti->second.AddPreBuildCommand(cc);
break;
case cmTarget::PRE_LINK:
- ti->second.GetPreLinkCommands().push_back(cc);
+ ti->second.AddPreLinkCommand(cc);
break;
case cmTarget::POST_BUILD:
- ti->second.GetPostBuildCommands().push_back(cc);
+ ti->second.AddPostBuildCommand(cc);
break;
}
}
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 015654b..d8e9b34 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -534,7 +534,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
}
- std::vector<cmCustomCommand> *cmdLists[3] = {
+ const std::vector<cmCustomCommand> *cmdLists[3] = {
&this->GetTarget()->GetPreBuildCommands(),
&this->GetTarget()->GetPreLinkCommands(),
&this->GetTarget()->GetPostBuildCommands()
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 36cb368..35717ce 100644
--- a/Source/cmQtAutoGenerators.cxx
+++ b/Source/cmQtAutoGenerators.cxx
@@ -257,7 +257,7 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmTarget* target)
workingDirectory.c_str());
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
- target->GetPreBuildCommands().push_back(cc);
+ target->AddPreBuildCommand(cc);
}
else
#endif
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index b516a0a..bafcb15 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -114,12 +114,18 @@ public:
/**
* Get the list of the custom commands for this target
*/
- std::vector<cmCustomCommand> &GetPreBuildCommands()
+ std::vector<cmCustomCommand> const &GetPreBuildCommands() const
{return this->PreBuildCommands;}
- std::vector<cmCustomCommand> &GetPreLinkCommands()
+ std::vector<cmCustomCommand> const &GetPreLinkCommands() const
{return this->PreLinkCommands;}
- std::vector<cmCustomCommand> &GetPostBuildCommands()
+ std::vector<cmCustomCommand> const &GetPostBuildCommands() const
{return this->PostBuildCommands;}
+ void AddPreBuildCommand(cmCustomCommand const &cmd)
+ {this->PreBuildCommands.push_back(cmd);}
+ void AddPreLinkCommand(cmCustomCommand const &cmd)
+ {this->PreLinkCommands.push_back(cmd);}
+ void AddPostBuildCommand(cmCustomCommand const &cmd)
+ {this->PostBuildCommands.push_back(cmd);}
/**
* Get the list of the source files used by this target
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index ace1eef..635d8cb 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1794,7 +1794,7 @@ cmVisualStudio10TargetGenerator::WriteEvents(std::string const& configName)
void cmVisualStudio10TargetGenerator::WriteEvent(
const char* name,
- std::vector<cmCustomCommand> & commands,
+ std::vector<cmCustomCommand> const& commands,
std::string const& configName)
{
if(commands.size() == 0)
@@ -1807,10 +1807,10 @@ void cmVisualStudio10TargetGenerator::WriteEvent(
std::string script;
const char* pre = "";
std::string comment;
- for(std::vector<cmCustomCommand>::iterator i = commands.begin();
+ for(std::vector<cmCustomCommand>::const_iterator i = commands.begin();
i != commands.end(); ++i)
{
- cmCustomCommand& command = *i;
+ const cmCustomCommand& command = *i;
comment += pre;
comment += lg->ConstructComment(command);
script += pre;
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 9a480a8..d1f3d19 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -87,7 +87,8 @@ private:
void AddLibraries(cmComputeLinkInformation& cli, std::string& libstring);
void WriteLibOptions(std::string const& config);
void WriteEvents(std::string const& configName);
- void WriteEvent(const char* name, std::vector<cmCustomCommand> & commands,
+ void WriteEvent(const char* name,
+ std::vector<cmCustomCommand> const& commands,
std::string const& configName);
void WriteGroupSources(const char* name, ToolSources const& sources,
std::vector<cmSourceGroup>& );