diff options
author | Brad King <brad.king@kitware.com> | 2015-09-24 14:28:54 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2015-09-24 14:28:54 (GMT) |
commit | cbfae8c3f2c971441d4943a630efe7b186ee0c44 (patch) | |
tree | 29a43d661df7cf923266855c174e1b774d90ac7e /Source | |
parent | 02ccef2ae586ce342cb76eaec61db0e2132081a4 (diff) | |
parent | 69ab5f55026c7e884a70f04aa7ddef776f74305b (diff) | |
download | CMake-cbfae8c3f2c971441d4943a630efe7b186ee0c44.zip CMake-cbfae8c3f2c971441d4943a630efe7b186ee0c44.tar.gz CMake-cbfae8c3f2c971441d4943a630efe7b186ee0c44.tar.bz2 |
Merge topic 'install-files-dest-genex'
69ab5f55 Tests: Cover install(FILES) with a genex DESTINATION
17aa6fd3 install: Allow generator expressions in FILES DESTINATION
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallFilesGenerator.cxx | 25 | ||||
-rw-r--r-- | Source/cmInstallFilesGenerator.h | 6 |
2 files changed, 26 insertions, 5 deletions
diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index c18b174..e2c16c8 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -34,6 +34,12 @@ cmInstallFilesGenerator Programs(programs), Optional(optional) { + // We need per-config actions if the destination has generator expressions. + if(cmGeneratorExpression::Find(Destination) != std::string::npos) + { + this->ActionsPerConfig = true; + } + // We need per-config actions if any files have generator expressions. for(std::vector<std::string>::const_iterator i = files.begin(); !this->ActionsPerConfig && i != files.end(); ++i) @@ -57,14 +63,25 @@ void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) } //---------------------------------------------------------------------------- +std::string +cmInstallFilesGenerator::GetDestination(std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination) + ->Evaluate(this->LocalGenerator->GetMakefile(), config); +} + +//---------------------------------------------------------------------------- void cmInstallFilesGenerator::AddFilesInstallRule( - std::ostream& os, Indent const& indent, + std::ostream& os, + const std::string config, + Indent const& indent, std::vector<std::string> const& files) { // Write code to install the files. const char* no_dir_permissions = 0; this->AddInstallRule(os, - this->Destination, + this->GetDestination(config), (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), @@ -84,7 +101,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, } else { - this->AddFilesInstallRule(os, indent, this->Files); + this->AddFilesInstallRule(os, "", indent, this->Files); } } @@ -102,5 +119,5 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os, cmSystemTools::ExpandListArgument(cge->Evaluate( this->LocalGenerator->GetMakefile(), config), files); } - this->AddFilesInstallRule(os, indent, files); + this->AddFilesInstallRule(os, config, indent, files); } diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 00b3a79..bfe4039 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -32,12 +32,16 @@ public: void Compute(cmLocalGenerator* lg); + std::string GetDestination(std::string const& config) const; + protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent); - void AddFilesInstallRule(std::ostream& os, Indent const& indent, + void AddFilesInstallRule(std::ostream& os, + const std::string config, + Indent const& indent, std::vector<std::string> const& files); cmLocalGenerator* LocalGenerator; |