summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-04-11 18:33:19 (GMT)
committerBrad King <brad.king@kitware.com>2017-04-18 13:03:33 (GMT)
commit26cfd039a9479959da1d893bcee5b2aa879da6c0 (patch)
tree26de42843e94101103ea8cb1523e1b6cd6560bca
parent25f3f22a1a952b98e7dc6772ef5fedd4932d0901 (diff)
downloadCMake-26cfd039a9479959da1d893bcee5b2aa879da6c0.zip
CMake-26cfd039a9479959da1d893bcee5b2aa879da6c0.tar.gz
CMake-26cfd039a9479959da1d893bcee5b2aa879da6c0.tar.bz2
cmInstallTargetGenerator: Re-order GenerateScriptForConfig logic
Do not populate some local variables before switching on the target type.
-rw-r--r--Source/cmInstallTargetGenerator.cxx41
1 files changed, 22 insertions, 19 deletions
diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx
index 88fcc56..5b43a1d 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);