diff options
author | Brad King <brad.king@kitware.com> | 2016-01-14 16:42:20 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2016-01-14 16:42:20 (GMT) |
commit | 9cf63886985f39bb364e620e4459252b9ba8072a (patch) | |
tree | 6b36637c5f089cf38141e50f1aa656b8a843c583 /Source | |
parent | 6be2dedaedec4d6df7844119d2e4954535d66ad2 (diff) | |
parent | 630c8aa8435fced988545d396714398faa3426b1 (diff) | |
download | CMake-9cf63886985f39bb364e620e4459252b9ba8072a.zip CMake-9cf63886985f39bb364e620e4459252b9ba8072a.tar.gz CMake-9cf63886985f39bb364e620e4459252b9ba8072a.tar.bz2 |
Merge topic 'install-DIRECTORY-genex'
630c8aa8 install: Allow generator expressions in DIRECTORY
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallDirectoryGenerator.cxx | 28 | ||||
-rw-r--r-- | Source/cmInstallDirectoryGenerator.h | 3 |
2 files changed, 26 insertions, 5 deletions
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index ea27f61..f2e8609 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -36,6 +36,16 @@ cmInstallDirectoryGenerator { this->ActionsPerConfig = true; } + + // We need per-config actions if any directories have generator expressions. + for(std::vector<std::string>::const_iterator i = dirs.begin(); + !this->ActionsPerConfig && i != dirs.end(); ++i) + { + if(cmGeneratorExpression::Find(*i) != std::string::npos) + { + this->ActionsPerConfig = true; + } + } } //---------------------------------------------------------------------------- @@ -60,7 +70,7 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, } else { - this->AddDirectoryInstallRule(os, "", indent); + this->AddDirectoryInstallRule(os, "", indent, this->Directories); } } @@ -69,20 +79,30 @@ void cmInstallDirectoryGenerator::GenerateScriptForConfig( const std::string& config, Indent const& indent) { - this->AddDirectoryInstallRule(os, config, indent); + std::vector<std::string> dirs; + cmGeneratorExpression ge; + for(std::vector<std::string>::const_iterator i = this->Directories.begin(); + i != this->Directories.end(); ++i) + { + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(*i); + cmSystemTools::ExpandListArgument(cge->Evaluate( + this->LocalGenerator, config), dirs); + } + this->AddDirectoryInstallRule(os, config, indent, dirs); } void cmInstallDirectoryGenerator::AddDirectoryInstallRule( std::ostream& os, const std::string& config, - Indent const& indent) + Indent const& indent, + std::vector<std::string> const& dirs) { // Write code to install the directories. const char* no_rename = 0; this->AddInstallRule(os, this->GetDestination(config), cmInstallType_DIRECTORY, - this->Directories, + dirs, this->Optional, this->FilePermissions.c_str(), this->DirPermissions.c_str(), diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 04107e1..9b732d3 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -42,7 +42,8 @@ protected: Indent const& indent); void AddDirectoryInstallRule(std::ostream& os, const std::string& config, - Indent const& indent); + Indent const& indent, + std::vector<std::string> const& dirs); cmLocalGenerator* LocalGenerator; std::vector<std::string> Directories; std::string FilePermissions; |