ENH: Cleanup per-config target install generation

This cleans up cmInstallTargetGenerator's code that computes the build
tree location of a target under each configuration.
This commit is contained in:
Brad King 2009-07-03 08:40:28 -04:00
parent 7c05c7bd89
commit 789eaf157c
2 changed files with 13 additions and 19 deletions

View File

@ -58,20 +58,6 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os)
cmSystemTools::Message(msg.str().c_str(), "Warning"); cmSystemTools::Message(msg.str().c_str(), "Warning");
} }
// Compute the build tree directory from which to copy the target.
std::string& fromDir = this->FromDir;
if(this->Target->NeedRelinkBeforeInstall())
{
fromDir = this->Target->GetMakefile()->GetStartOutputDirectory();
fromDir += cmake::GetCMakeFilesDirectory();
fromDir += "/CMakeRelink.dir/";
}
else
{
fromDir = this->Target->GetDirectory(0, this->ImportLibrary);
fromDir += "/";
}
// Perform the main install script generation. // Perform the main install script generation.
this->cmInstallGenerator::GenerateScript(os); this->cmInstallGenerator::GenerateScript(os);
} }
@ -81,10 +67,19 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os,
const char* config, const char* config,
Indent const& indent) Indent const& indent)
{ {
// Compute the per-configuration directory containing the files. // Compute the build tree directory from which to copy the target.
std::string fromDirConfig = this->FromDir; std::string fromDirConfig;
this->Target->GetMakefile()->GetLocalGenerator()->GetGlobalGenerator() if(this->Target->NeedRelinkBeforeInstall())
->AppendDirectoryForConfig("", config, "/", fromDirConfig); {
fromDirConfig = this->Target->GetMakefile()->GetStartOutputDirectory();
fromDirConfig += cmake::GetCMakeFilesDirectory();
fromDirConfig += "/CMakeRelink.dir/";
}
else
{
fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary);
fromDirConfig += "/";
}
// Compute the full path to the main installed file for this target. // Compute the full path to the main installed file for this target.
NameType nameType = this->ImportLibrary? NameImplib : NameNormal; NameType nameType = this->ImportLibrary? NameImplib : NameNormal;

View File

@ -90,7 +90,6 @@ protected:
std::string FilePermissions; std::string FilePermissions;
bool Optional; bool Optional;
NamelinkModeType NamelinkMode; NamelinkModeType NamelinkMode;
std::string FromDir;
}; };
#endif #endif