summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-01-11 15:07:27 (GMT)
committerBrad King <brad.king@kitware.com>2021-01-28 17:46:32 (GMT)
commit5b23d8a7b1e913df8261895f77a2140199a0b812 (patch)
treefb4a3b64f0e76ffea8c575adeba03d7addc41fd8
parent599027622652421deca0ca9ef749a48a24eea509 (diff)
downloadCMake-5b23d8a7b1e913df8261895f77a2140199a0b812.zip
CMake-5b23d8a7b1e913df8261895f77a2140199a0b812.tar.gz
CMake-5b23d8a7b1e913df8261895f77a2140199a0b812.tar.bz2
cmInstallFilesGenerator: Factor out method to get list of files
-rw-r--r--Source/cmInstallFilesGenerator.cxx22
-rw-r--r--Source/cmInstallFilesGenerator.h2
2 files changed, 19 insertions, 5 deletions
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx
index 0a353e4..1d816b7 100644
--- a/Source/cmInstallFilesGenerator.cxx
+++ b/Source/cmInstallFilesGenerator.cxx
@@ -66,6 +66,22 @@ std::string cmInstallFilesGenerator::GetRename(std::string const& config) const
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)
@@ -92,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);
}
diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h
index 66145f4..7438440 100644
--- a/Source/cmInstallFilesGenerator.h
+++ b/Source/cmInstallFilesGenerator.h
@@ -32,6 +32,8 @@ public:
std::string GetDestination(std::string const& config) const;
std::string GetRename(std::string const& config) const;
+ std::vector<std::string> GetFiles(std::string const& config) const;
+ bool GetOptional() const { return this->Optional; }
protected:
void GenerateScriptActions(std::ostream& os, Indent indent) override;