|
@@ -29,7 +29,7 @@ namespace {
|
|
|
std::string EvaluateSplitConfigGenex(
|
|
|
cm::string_view input, cmGeneratorExpression const& ge, cmLocalGenerator* lg,
|
|
|
bool useOutputConfig, std::string const& outputConfig,
|
|
|
- std::string const& commandConfig,
|
|
|
+ std::string const& commandConfig, cmGeneratorTarget const* target,
|
|
|
std::set<BT<std::pair<std::string, bool>>>* utils = nullptr)
|
|
|
{
|
|
|
std::string result;
|
|
@@ -87,7 +87,7 @@ std::string EvaluateSplitConfigGenex(
|
|
|
// Evaluate this genex in the selected configuration.
|
|
|
std::unique_ptr<cmCompiledGeneratorExpression> cge =
|
|
|
ge.Parse(std::string(genex));
|
|
|
- result += cge->Evaluate(lg, *config);
|
|
|
+ result += cge->Evaluate(lg, *config, target);
|
|
|
|
|
|
// Record targets referenced by the genex.
|
|
|
if (utils) {
|
|
@@ -114,7 +114,8 @@ std::vector<std::string> EvaluateDepends(std::vector<std::string> const& paths,
|
|
|
std::string const& ep =
|
|
|
EvaluateSplitConfigGenex(p, ge, lg, /*useOutputConfig=*/true,
|
|
|
/*outputConfig=*/outputConfig,
|
|
|
- /*commandConfig=*/commandConfig);
|
|
|
+ /*commandConfig=*/commandConfig,
|
|
|
+ /*target=*/nullptr);
|
|
|
cm::append(depends, cmExpandedList(ep));
|
|
|
}
|
|
|
for (std::string& p : depends) {
|
|
@@ -157,6 +158,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
|
|
|
: CC(&cc)
|
|
|
, OutputConfig(crossConfig ? *crossConfig : config)
|
|
|
, CommandConfig(std::move(config))
|
|
|
+ , Target(cc.GetTarget())
|
|
|
, LG(lg)
|
|
|
, OldStyle(cc.GetEscapeOldStyle())
|
|
|
, MakeVars(cc.GetEscapeAllowMakeVars())
|
|
@@ -171,6 +173,8 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
|
|
|
}
|
|
|
|
|
|
cmGeneratorExpression ge(cc.GetBacktrace());
|
|
|
+ cmGeneratorTarget const* target{ lg->FindGeneratorTargetToUse(
|
|
|
+ this->Target) };
|
|
|
|
|
|
const cmCustomCommandLines& cmdlines = this->CC->GetCommandLines();
|
|
|
for (cmCustomCommandLine const& cmdline : cmdlines) {
|
|
@@ -180,7 +184,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
|
|
|
for (std::string const& clarg : cmdline) {
|
|
|
std::string parsed_arg = EvaluateSplitConfigGenex(
|
|
|
clarg, ge, this->LG, useOutputConfig, this->OutputConfig,
|
|
|
- this->CommandConfig, &this->Utilities);
|
|
|
+ this->CommandConfig, target, &this->Utilities);
|
|
|
if (this->CC->GetCommandExpandLists()) {
|
|
|
cm::append(argv, cmExpandedList(parsed_arg));
|
|
|
} else {
|
|
@@ -249,9 +253,9 @@ cmCustomCommandGenerator::cmCustomCommandGenerator(
|
|
|
|
|
|
const std::string& workingdirectory = this->CC->GetWorkingDirectory();
|
|
|
if (!workingdirectory.empty()) {
|
|
|
- this->WorkingDirectory =
|
|
|
- EvaluateSplitConfigGenex(workingdirectory, ge, this->LG, true,
|
|
|
- this->OutputConfig, this->CommandConfig);
|
|
|
+ this->WorkingDirectory = EvaluateSplitConfigGenex(
|
|
|
+ workingdirectory, ge, this->LG, true, this->OutputConfig,
|
|
|
+ this->CommandConfig, target);
|
|
|
// Convert working directory to a full path.
|
|
|
if (!this->WorkingDirectory.empty()) {
|
|
|
std::string const& build_dir = this->LG->GetCurrentBinaryDirectory();
|