summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-02-11 19:02:45 (GMT)
committerBrad King <brad.king@kitware.com>2015-02-11 20:15:33 (GMT)
commitf30022eb07b913598326d2e3b10ff2e706fbe873 (patch)
treec4b40ec96cd6affe7b091548540e5ac0df659ce3 /Source/cmInstallTargetGenerator.cxx
parent7607c3d16aa0636458c909f4036e4b0d91581b30 (diff)
downloadCMake-f30022eb07b913598326d2e3b10ff2e706fbe873.zip
CMake-f30022eb07b913598326d2e3b10ff2e706fbe873.tar.gz
CMake-f30022eb07b913598326d2e3b10ff2e706fbe873.tar.bz2
install: Allow generator expressions in TARGETS DESTINATION (#14317)
This will allow per-config destinations for targets in EXPORT sets. Using multiple install(TARGETS) with separate CONFIGURATIONS is rejected as a target appearing more than once in an export set. Now instead one can write install(TARGETS foo EXPORT exp DESTINATION lib/$<CONFIG>) to get a single logical membership of the target in the export set while still having a per-config destination.
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx14
1 files changed, 12 insertions, 2 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 7ab88f1..b035bad 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -12,6 +12,7 @@
#include "cmInstallTargetGenerator.h"
#include "cmComputeLinkInformation.h"
+#include "cmGeneratorExpression.h"
#include "cmGlobalGenerator.h"
#include "cmLocalGenerator.h"
#include "cmMakefile.h"
@@ -78,7 +79,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
fromDirConfig += "/";
}
std::string toDir =
- this->ConvertToAbsoluteDestination(this->Destination);
+ this->ConvertToAbsoluteDestination(this->GetDestination(config));
toDir += "/";
// Compute the list of files to install for this target.
@@ -323,7 +324,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* no_dir_permissions = 0;
const char* no_rename = 0;
bool optional = this->Optional || this->ImportLibrary;
- this->AddInstallRule(os, this->Destination,
+ this->AddInstallRule(os, this->GetDestination(config),
type, filesFrom, optional,
this->FilePermissions.c_str(), no_dir_permissions,
no_rename, literal_args.c_str(),
@@ -336,6 +337,15 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
//----------------------------------------------------------------------------
std::string
+cmInstallTargetGenerator::GetDestination(std::string const& config) const
+{
+ cmGeneratorExpression ge;
+ return ge.Parse(this->Destination)
+ ->Evaluate(this->Target->GetMakefile(), config);
+}
+
+//----------------------------------------------------------------------------
+std::string
cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const
{
NameType nameType = this->ImportLibrary? NameImplib : NameNormal;