summaryrefslogtreecommitdiffstats
path: root/Source/cmCustomCommandGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2010-12-08 21:13:07 (GMT)
committerBrad King <brad.king@kitware.com>2010-12-15 19:53:48 (GMT)
commitf0cdb6001b3e915fc0d9c1120165d49725440bbd (patch)
treea310c36370b6935d7458f70a61e3eada72ce8b08 /Source/cmCustomCommandGenerator.cxx
parent4749e4cb76cc1e23cb23f37ceec2e856a18218ce (diff)
downloadCMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.zip
CMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.tar.gz
CMake-f0cdb6001b3e915fc0d9c1120165d49725440bbd.tar.bz2
Introduce "generator expression" syntax to custom commands (#11209)
Evaluate in the COMMAND arguments of custom commands the generator expression syntax introduced in commit d2e1f2b4 (Introduce "generator expressions" to add_test, 2009-08-11). These expressions have a syntax like $<TARGET_FILE:mytarget> and are evaluated during build system generation. This syntax allows per-configuration target output files to be referenced in custom command lines.
Diffstat (limited to 'Source/cmCustomCommandGenerator.cxx')
-rw-r--r--Source/cmCustomCommandGenerator.cxx14
1 files changed, 11 insertions, 3 deletions
diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx
index 2a3b553..a650129 100644
--- a/Source/cmCustomCommandGenerator.cxx
+++ b/Source/cmCustomCommandGenerator.cxx
@@ -14,16 +14,24 @@
#include "cmMakefile.h"
#include "cmCustomCommand.h"
#include "cmLocalGenerator.h"
+#include "cmGeneratorExpression.h"
//----------------------------------------------------------------------------
cmCustomCommandGenerator::cmCustomCommandGenerator(
cmCustomCommand const& cc, const char* config, cmMakefile* mf):
CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()),
- OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars())
+ OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()),
+ GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace()))
{
}
//----------------------------------------------------------------------------
+cmCustomCommandGenerator::~cmCustomCommandGenerator()
+{
+ delete this->GE;
+}
+
+//----------------------------------------------------------------------------
unsigned int cmCustomCommandGenerator::GetNumberOfCommands() const
{
return static_cast<unsigned int>(this->CC.GetCommandLines().size());
@@ -39,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
{
return target->GetLocation(this->Config);
}
- return argv0;
+ return this->GE->Process(argv0);
}
//----------------------------------------------------------------------------
@@ -50,7 +58,7 @@ cmCustomCommandGenerator
cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c];
for(unsigned int j=1;j < commandLine.size(); ++j)
{
- std::string const& arg = commandLine[j];
+ std::string arg = this->GE->Process(commandLine[j]);
cmd += " ";
if(this->OldStyle)
{