summaryrefslogtreecommitdiff
path: root/Source/cmInstallTargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-11 14:33:19 -0400
committerBrad King <brad.king@kitware.com>2017-04-18 09:03:33 -0400
commit26cfd039a9479959da1d893bcee5b2aa879da6c0 (patch)
tree26de42843e94101103ea8cb1523e1b6cd6560bca /Source/cmInstallTargetGenerator.cxx
parent25f3f22a1a952b98e7dc6772ef5fedd4932d0901 (diff)
downloadcmake-26cfd039a9479959da1d893bcee5b2aa879da6c0.tar.gz
cmInstallTargetGenerator: Re-order GenerateScriptForConfig logic
Do not populate some local variables before switching on the target type.
Diffstat (limited to 'Source/cmInstallTargetGenerator.cxx')
-rw-r--r--Source/cmInstallTargetGenerator.cxx41
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 88fcc56acb..5b43a1d588 100644
--- a/Source/cmInstallTargetGenerator.cxx
+++ b/Source/cmInstallTargetGenerator.cxx
@@ -60,25 +60,6 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
void cmInstallTargetGenerator::GenerateScriptForConfig(
std::ostream& os, const std::string& config, Indent const& indent)
{
- // Compute the build tree directory from which to copy the target.
- std::string fromDirConfig;
- if (this->Target->NeedRelinkBeforeInstall(config)) {
- fromDirConfig =
- this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
- fromDirConfig += cmake::GetCMakeFilesDirectory();
- fromDirConfig += "/CMakeRelink.dir/";
- } else {
- fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
- fromDirConfig += "/";
- }
- std::string toDir =
- this->ConvertToAbsoluteDestination(this->GetDestination(config));
- toDir += "/";
-
- // Compute the list of files to install for this target.
- std::vector<std::string> filesFrom;
- std::vector<std::string> filesTo;
- std::string literal_args;
cmStateEnums::TargetType targetType = this->Target->GetType();
cmInstallType type = cmInstallType();
switch (targetType) {
@@ -109,6 +90,28 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(
"cmInstallTargetGenerator created with non-installable target.");
return;
}
+
+ // Compute the build tree directory from which to copy the target.
+ std::string fromDirConfig;
+ if (this->Target->NeedRelinkBeforeInstall(config)) {
+ fromDirConfig =
+ this->Target->GetLocalGenerator()->GetCurrentBinaryDirectory();
+ fromDirConfig += cmake::GetCMakeFilesDirectory();
+ fromDirConfig += "/CMakeRelink.dir/";
+ } else {
+ fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
+ fromDirConfig += "/";
+ }
+
+ std::string toDir =
+ this->ConvertToAbsoluteDestination(this->GetDestination(config));
+ toDir += "/";
+
+ // Compute the list of files to install for this target.
+ std::vector<std::string> filesFrom;
+ std::vector<std::string> filesTo;
+ std::string literal_args;
+
if (targetType == cmStateEnums::EXECUTABLE) {
// There is a bug in cmInstallCommand if this fails.
assert(this->NamelinkMode == NamelinkModeNone);