mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
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.
This commit is contained in:
@@ -14,15 +14,23 @@
|
||||
#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
|
||||
{
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user