diff options
Diffstat (limited to 'Source/cmInstallFilesGenerator.cxx')
-rw-r--r-- | Source/cmInstallFilesGenerator.cxx | 42 |
1 files changed, 32 insertions, 10 deletions
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index ad2f84e024..556c938274 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -15,9 +15,9 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( bool programs, std::string file_permissions, std::vector<std::string> const& configurations, std::string const& component, MessageLevel message, bool exclude_from_all, std::string rename, - bool optional) + bool optional, cmListFileBacktrace backtrace) : cmInstallGenerator(dest, configurations, component, message, - exclude_from_all) + exclude_from_all, std::move(backtrace)) , LocalGenerator(nullptr) , Files(files) , FilePermissions(std::move(file_permissions)) @@ -25,8 +25,12 @@ cmInstallFilesGenerator::cmInstallFilesGenerator( , Programs(programs) , Optional(optional) { - // We need per-config actions if the destination has generator expressions. - if (cmGeneratorExpression::Find(Destination) != std::string::npos) { + // We need per-config actions if the destination and rename have generator + // expressions. + if (cmGeneratorExpression::Find(this->Destination) != std::string::npos) { + this->ActionsPerConfig = true; + } + if (cmGeneratorExpression::Find(this->Rename) != std::string::npos) { this->ActionsPerConfig = true; } @@ -56,6 +60,28 @@ std::string cmInstallFilesGenerator::GetDestination( this->LocalGenerator, config); } +std::string cmInstallFilesGenerator::GetRename(std::string const& config) const +{ + return cmGeneratorExpression::Evaluate(this->Rename, this->LocalGenerator, + config); +} + +std::vector<std::string> cmInstallFilesGenerator::GetFiles( + std::string const& config) const +{ + std::vector<std::string> files; + if (this->ActionsPerConfig) { + for (std::string const& f : this->Files) { + cmExpandList( + cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), + files); + } + } else { + files = this->Files; + } + return files; +} + void cmInstallFilesGenerator::AddFilesInstallRule( std::ostream& os, std::string const& config, Indent indent, std::vector<std::string> const& files) @@ -66,7 +92,7 @@ void cmInstallFilesGenerator::AddFilesInstallRule( os, this->GetDestination(config), (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), files, this->Optional, this->FilePermissions.c_str(), no_dir_permissions, - this->Rename.c_str(), nullptr, indent); + this->GetRename(config).c_str(), nullptr, indent); } void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, @@ -82,10 +108,6 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, void cmInstallFilesGenerator::GenerateScriptForConfig( std::ostream& os, const std::string& config, Indent indent) { - std::vector<std::string> files; - for (std::string const& f : this->Files) { - cmExpandList( - cmGeneratorExpression::Evaluate(f, this->LocalGenerator, config), files); - } + std::vector<std::string> files = this->GetFiles(config); this->AddFilesInstallRule(os, config, indent, files); } |