summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2021-01-13 10:27:56 (GMT)
committerAsit Dhal <dhal.asitk@gmail.com>2021-01-13 10:27:56 (GMT)
commitac3ccc393e359063f498a33696c1785672a28d40 (patch)
treecad769c4ccc1c466d2994dc8c7a571cdb39fbbf5 /Source
parent20a7d4485cb3f6520abc22d22fd516a19e4cfdb2 (diff)
downloadCMake-ac3ccc393e359063f498a33696c1785672a28d40.zip
CMake-ac3ccc393e359063f498a33696c1785672a28d40.tar.gz
CMake-ac3ccc393e359063f498a33696c1785672a28d40.tar.bz2
install(files): Support genex in rename option
Fixes: #19903
Diffstat (limited to 'Source')
-rw-r--r--Source/cmInstallFilesGenerator.cxx14
-rw-r--r--Source/cmInstallFilesGenerator.h1
2 files changed, 13 insertions, 2 deletions
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index c45000d..0a353e4 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -25,10 +25,14 @@ cmInstallFilesGenerator::cmInstallFilesGenerator(
, Programs(programs)
, Optional(optional)
{
- // We need per-config actions if the destination has generator expressions.
+ // 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;
+ }
// We need per-config actions if any directories have generator expressions.
if (!this->ActionsPerConfig) {
@@ -56,6 +60,12 @@ std::string cmInstallFilesGenerator::GetDestination(
this->LocalGenerator, config);
}
+std::string cmInstallFilesGenerator::GetRename(std::string const& config) const
+{
+ return cmGeneratorExpression::Evaluate(this->Rename, this->LocalGenerator,
+ config);
+}
+
void cmInstallFilesGenerator::AddFilesInstallRule(
std::ostream& os, std::string const& config, Indent indent,
std::vector<std::string> const& files)
@@ -66,7 +76,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,
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index b5a1ef4..66145f4 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -31,6 +31,7 @@ public:
bool Compute(cmLocalGenerator* lg) override;
std::string GetDestination(std::string const& config) const;
+ std::string GetRename(std::string const& config) const;
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;