summaryrefslogtreecommitdiffstats
path: root/Source/cmTarget.cxx
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-10-07 09:01:13 (GMT)
committerStephen Kelly <steveire@gmail.com>2013-10-29 14:42:42 (GMT)
commit638843af984281c67edcc9ea9e05712ac9075d04 (patch)
tree9af9dd9ba6f2afb237add4021e983ce1e34e84df /Source/cmTarget.cxx
parent90ef1cfe4882139d9fe525352bc8e2e86b69f1db (diff)
downloadCMake-638843af984281c67edcc9ea9e05712ac9075d04.zip
CMake-638843af984281c67edcc9ea9e05712ac9075d04.tar.gz
CMake-638843af984281c67edcc9ea9e05712ac9075d04.tar.bz2
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.
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r--Source/cmTarget.cxx31
1 files changed, 19 insertions, 12 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 13554dd..0c9e8f0 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -2721,27 +2721,34 @@ const char* cmTarget::GetLocation(const char* config)
//----------------------------------------------------------------------------
const char* cmTarget::ImportedGetLocation(const char* config)
{
- this->Location = this->ImportedGetFullPath(config, false);
- return this->Location.c_str();
+ static std::string location;
+ location = this->ImportedGetFullPath(config, false);
+ return location.c_str();
}
//----------------------------------------------------------------------------
const char* cmTarget::NormalGetLocation(const char* config)
{
+ static std::string location;
// Handle the configuration-specific case first.
if(config)
{
- this->Location = this->GetFullPath(config, false);
- return this->Location.c_str();
+ location = this->GetFullPath(config, false);
+ return location.c_str();
}
// 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");
if(cfgid && strcmp(cfgid, ".") != 0)
{
- this->Location += "/";
- this->Location += cfgid;
+ location += "/";
+ location += cfgid;
+ location += "/";
}
if(this->IsAppBundleOnApple())
@@ -2749,13 +2756,13 @@ const char* cmTarget::NormalGetLocation(const char* config)
std::string macdir = this->BuildMacContentDirectory("", config, false);
if(!macdir.empty())
{
- this->Location += "/";
- this->Location += macdir;
+ location += "/";
+ location += macdir;
}
}
- this->Location += "/";
- this->Location += this->GetFullName(config, false);
- return this->Location.c_str();
+ location += "/";
+ location += this->GetFullName(config, false);
+ return location.c_str();
}
//----------------------------------------------------------------------------