Remove the Location member from cmTarget.

It is never used. Presumably it only exists so that a const char * can
be returned from GetLocation. However, that is getting in the way
now, so use a static std::string instead, which is already a common
pattern in cmake.
This commit is contained in:
Stephen Kelly 2012-10-07 11:01:13 +02:00
parent 90ef1cfe48
commit 638843af98
2 changed files with 19 additions and 13 deletions

View File

@ -2721,27 +2721,34 @@ const char* cmTarget::GetLocation(const char* config)
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmTarget::ImportedGetLocation(const char* config) const char* cmTarget::ImportedGetLocation(const char* config)
{ {
this->Location = this->ImportedGetFullPath(config, false); static std::string location;
return this->Location.c_str(); location = this->ImportedGetFullPath(config, false);
return location.c_str();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
const char* cmTarget::NormalGetLocation(const char* config) const char* cmTarget::NormalGetLocation(const char* config)
{ {
static std::string location;
// Handle the configuration-specific case first. // Handle the configuration-specific case first.
if(config) if(config)
{ {
this->Location = this->GetFullPath(config, false); location = this->GetFullPath(config, false);
return this->Location.c_str(); return location.c_str();
} }
// Now handle the deprecated build-time configuration location. // Now handle the deprecated build-time configuration location.
this->Location = this->GetDirectory(); location = this->GetDirectory();
if(!location.empty())
{
location += "/";
}
const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR"); const char* cfgid = this->Makefile->GetDefinition("CMAKE_CFG_INTDIR");
if(cfgid && strcmp(cfgid, ".") != 0) if(cfgid && strcmp(cfgid, ".") != 0)
{ {
this->Location += "/"; location += "/";
this->Location += cfgid; location += cfgid;
location += "/";
} }
if(this->IsAppBundleOnApple()) if(this->IsAppBundleOnApple())
@ -2749,13 +2756,13 @@ const char* cmTarget::NormalGetLocation(const char* config)
std::string macdir = this->BuildMacContentDirectory("", config, false); std::string macdir = this->BuildMacContentDirectory("", config, false);
if(!macdir.empty()) if(!macdir.empty())
{ {
this->Location += "/"; location += "/";
this->Location += macdir; location += macdir;
} }
} }
this->Location += "/"; location += "/";
this->Location += this->GetFullName(config, false); location += this->GetFullName(config, false);
return this->Location.c_str(); return location.c_str();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View File

@ -674,7 +674,6 @@ private:
bool HaveInstallRule; bool HaveInstallRule;
std::string InstallPath; std::string InstallPath;
std::string RuntimeInstallPath; std::string RuntimeInstallPath;
std::string Location;
std::string ExportMacro; std::string ExportMacro;
std::set<cmStdString> Utilities; std::set<cmStdString> Utilities;
bool RecordDependencies; bool RecordDependencies;