summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-25 14:12:40 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-09-25 14:12:40 (GMT)
commit5a83303f50e7eadddae9bad0d13a7f751f733136 (patch)
tree42733a2a62d1f570c024b538ece5c05a81c9875a /Source
parent910ea2100425289ec4f13327141b5c45ede320bd (diff)
parentbd189cc24e2292ab80dde7c0d0ac1cd9fafb2d35 (diff)
downloadCMake-5a83303f50e7eadddae9bad0d13a7f751f733136.zip
CMake-5a83303f50e7eadddae9bad0d13a7f751f733136.tar.gz
CMake-5a83303f50e7eadddae9bad0d13a7f751f733136.tar.bz2
Merge topic 'install-directory-dest-genex'
bd189cc2 install: Allow generator expressions in DIRECTORY DESTINATION
Diffstat (limited to 'Source')
-rw-r--r--Source/cmInstallDirectoryGenerator.cxx47
-rw-r--r--Source/cmInstallDirectoryGenerator.h11
2 files changed, 57 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);
+}
diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h
index 165ab91..04107e1 100644
--- a/Source/cmInstallDirectoryGenerator.h
+++ b/Source/cmInstallDirectoryGenerator.h
@@ -31,8 +31,19 @@ public:
bool optional = false);
virtual ~cmInstallDirectoryGenerator();
+ 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 AddDirectoryInstallRule(std::ostream& os,
+ const std::string& config,
+ Indent const& indent);
+ cmLocalGenerator* LocalGenerator;
std::vector<std::string> Directories;
std::string FilePermissions;
std::string DirPermissions;