BUG: For imported target directory, do not return pointer to freed memory.

This commit is contained in:
Brad King 2007-11-21 08:59:43 -05:00
parent 553852f990
commit 91f68fc391
1 changed files with 3 additions and 3 deletions

View File

@ -1322,8 +1322,8 @@ const char* cmTarget::GetDirectory(const char* config, bool implib)
const char* cmTarget::ImportedGetDirectory(const char* config, bool) const char* cmTarget::ImportedGetDirectory(const char* config, bool)
{ {
const char* location=this->GetLocation(config); const char* location=this->GetLocation(config);
std::string directory=cmSystemTools::GetFilenamePath(location); this->Directory = cmSystemTools::GetFilenamePath(location);
return directory.c_str(); return this->Directory.c_str();
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
@ -1362,7 +1362,7 @@ const char* cmTarget::ImportedGetLocation(const char* config)
{ {
if ((config) && (strlen(config))) if ((config) && (strlen(config)))
{ {
std::string propertyName=config; std::string propertyName=cmSystemTools::UpperCase(config);
propertyName+="_LOCATION"; propertyName+="_LOCATION";
const char* configLocation=this->GetProperty(propertyName.c_str()); const char* configLocation=this->GetProperty(propertyName.c_str());
if ((configLocation) && (strlen(configLocation))) if ((configLocation) && (strlen(configLocation)))