summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallDirectoryGenerator.cxx
diff options
context:
space:
mode:
authorRobert Goulet <robert.goulet@autodesk.com>2015-09-23 21:15:29 (GMT)
committerBrad King <brad.king@kitware.com>2015-09-24 13:13:03 (GMT)
commitbd189cc24e2292ab80dde7c0d0ac1cd9fafb2d35 (patch)
tree27ffc539451f22c4aff837ba8d5b26e97d52ad98 /Source/cmInstallDirectoryGenerator.cxx
parent69ab5f55026c7e884a70f04aa7ddef776f74305b (diff)
downloadCMake-bd189cc24e2292ab80dde7c0d0ac1cd9fafb2d35.zip
CMake-bd189cc24e2292ab80dde7c0d0ac1cd9fafb2d35.tar.gz
CMake-bd189cc24e2292ab80dde7c0d0ac1cd9fafb2d35.tar.bz2
install: Allow generator expressions in DIRECTORY DESTINATION
Diffstat (limited to 'Source/cmInstallDirectoryGenerator.cxx')
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx47
1 files changed, 46 insertions, 1 deletions
diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx
index 7593380..78cb5f0 100644
--- a/Source/cmInstallDirectoryGenerator.cxx
+++ b/Source/cmInstallDirectoryGenerator.cxx
@@ -12,6 +12,8 @@
#include "cmInstallDirectoryGenerator.h"
#include "cmTarget.h"
+#include "cmGeneratorExpression.h"
+#include "cmLocalGenerator.h"
//----------------------------------------------------------------------------
cmInstallDirectoryGenerator
@@ -25,10 +27,16 @@ cmInstallDirectoryGenerator
const char* literal_args,
bool optional):
cmInstallGenerator(dest, configurations, component, message),
+ LocalGenerator(0),
Directories(dirs),
FilePermissions(file_permissions), DirPermissions(dir_permissions),
LiteralArguments(literal_args), Optional(optional)
{
+ // We need per-config actions if destination have generator expressions.
+ if(cmGeneratorExpression::Find(Destination) != std::string::npos)
+ {
+ this->ActionsPerConfig = true;
+ }
}
//----------------------------------------------------------------------------
@@ -37,15 +45,43 @@ cmInstallDirectoryGenerator
{
}
+void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg)
+{
+ LocalGenerator = lg;
+}
+
//----------------------------------------------------------------------------
void
cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
Indent const& indent)
{
+ if(this->ActionsPerConfig)
+ {
+ this->cmInstallGenerator::GenerateScriptActions(os, indent);
+ }
+ else
+ {
+ this->AddDirectoryInstallRule(os, "", indent);
+ }
+}
+
+void cmInstallDirectoryGenerator::GenerateScriptForConfig(
+ std::ostream& os,
+ const std::string& config,
+ Indent const& indent)
+{
+ this->AddDirectoryInstallRule(os, config, indent);
+}
+
+void cmInstallDirectoryGenerator::AddDirectoryInstallRule(
+ std::ostream& os,
+ const std::string& config,
+ Indent const& indent)
+{
// Write code to install the directories.
const char* no_rename = 0;
this->AddInstallRule(os,
- this->Destination,
+ this->GetDestination(config),
cmInstallType_DIRECTORY,
this->Directories,
this->Optional,
@@ -54,3 +90,12 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os,
no_rename, this->LiteralArguments.c_str(),
indent);
}
+
+//----------------------------------------------------------------------------
+std::string
+cmInstallDirectoryGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->LocalGenerator->GetMakefile(), config);
+}