diff options
author | Yves Frederix <yves.frederix@gmail.com> | 2016-01-12 20:01:07 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-01-13 14:02:06 (GMT) |
commit | 630c8aa8435fced988545d396714398faa3426b1 (patch) | |
tree | 9cae7d2f3ddd216a6f03c777b5cbddc01527e54d /Source/cmInstallDirectoryGenerator.cxx | |
parent | b5009720d3020021f189570d72c099963795a5c5 (diff) | |
download | CMake-630c8aa8435fced988545d396714398faa3426b1.zip CMake-630c8aa8435fced988545d396714398faa3426b1.tar.gz CMake-630c8aa8435fced988545d396714398faa3426b1.tar.bz2 |
install: Allow generator expressions in DIRECTORY
Teach install(DIRECTORY) to support generator expressions in the list
of directories, much like install(FILES) already supports.
Diffstat (limited to 'Source/cmInstallDirectoryGenerator.cxx')
-rw-r--r-- | Source/cmInstallDirectoryGenerator.cxx | 28 |
1 files changed, 24 insertions, 4 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(), |