summaryrefslogtreecommitdiff
path: root/Source/cmInstallScriptGenerator.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'Source/cmInstallScriptGenerator.cxx')
-rw-r--r--Source/cmInstallScriptGenerator.cxx32
1 files changed, 19 insertions, 13 deletions
diff --git a/Source/cmInstallScriptGenerator.cxx b/Source/cmInstallScriptGenerator.cxx
index 7cdf3b45b..bb389906a 100644
--- a/Source/cmInstallScriptGenerator.cxx
+++ b/Source/cmInstallScriptGenerator.cxx
@@ -14,15 +14,15 @@
cmInstallScriptGenerator::cmInstallScriptGenerator(
std::string script, bool code, std::string const& component,
- bool exclude_from_all)
+ bool exclude_from_all, cmListFileBacktrace backtrace)
: cmInstallGenerator("", std::vector<std::string>(), component,
- MessageDefault, exclude_from_all)
+ MessageDefault, exclude_from_all, std::move(backtrace))
, Script(std::move(script))
, Code(code)
, AllowGenex(false)
{
// We need per-config actions if the script has generator expressions.
- if (cmGeneratorExpression::Find(Script) != std::string::npos) {
+ if (cmGeneratorExpression::Find(this->Script) != std::string::npos) {
this->ActionsPerConfig = true;
}
}
@@ -53,9 +53,21 @@ bool cmInstallScriptGenerator::Compute(cmLocalGenerator* lg)
return true;
}
-void cmInstallScriptGenerator::AddScriptInstallRule(std::ostream& os,
- Indent indent,
- std::string const& script)
+std::string cmInstallScriptGenerator::GetScript(
+ std::string const& config) const
+{
+ std::string script;
+ if (this->AllowGenex && this->ActionsPerConfig) {
+ script = cmGeneratorExpression::Evaluate(this->Script,
+ this->LocalGenerator, config);
+ } else {
+ script = this->Script;
+ }
+ return script;
+}
+
+void cmInstallScriptGenerator::AddScriptInstallRule(
+ std::ostream& os, Indent indent, std::string const& script) const
{
if (this->Code) {
os << indent << script << "\n";
@@ -77,11 +89,5 @@ void cmInstallScriptGenerator::GenerateScriptActions(std::ostream& os,
void cmInstallScriptGenerator::GenerateScriptForConfig(
std::ostream& os, const std::string& config, Indent indent)
{
- if (this->AllowGenex) {
- this->AddScriptInstallRule(os, indent,
- cmGeneratorExpression::Evaluate(
- this->Script, this->LocalGenerator, config));
- } else {
- this->AddScriptInstallRule(os, indent, this->Script);
- }
+ this->AddScriptInstallRule(os, indent, this->GetScript(config));
}