summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2008-12-16 14:14:40 (GMT)
committerBrad King <brad.king@kitware.com>2008-12-16 14:14:40 (GMT)
commit3cf9265fa7d1f6c7753ae5f19947409e4d9b8e9c (patch)
tree3fc931ad8e1d7e26aa00a41009e35cb53538bb12 /Source/cmLocalGenerator.cxx
parent63e186a8e69e0283d4fa0499ee8679ebdd844e1d (diff)
downloadCMake-3cf9265fa7d1f6c7753ae5f19947409e4d9b8e9c.zip
CMake-3cf9265fa7d1f6c7753ae5f19947409e4d9b8e9c.tar.gz
CMake-3cf9265fa7d1f6c7753ae5f19947409e4d9b8e9c.tar.bz2
ENH: Refactor passing of max length object dir
When computing the maximum length full path to the build directory under which object files will be placed, pass the actual path instead of just its length. This will be useful for error message generation.
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx19
1 files changed, 10 insertions, 9 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index fd8da18..d5260a9 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -645,10 +645,10 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target)
!sf->GetPropertyAsBool("HEADER_FILE_ONLY") &&
!sf->GetPropertyAsBool("EXTERNAL_OBJECT"))
{
- std::string::size_type dir_len = 0;
- dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
- dir_len += 1;
- std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_len);
+ std::string dir_max;
+ dir_max += this->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ std::string obj = this->GetObjectFileNameWithoutTarget(*sf, dir_max);
if(!obj.empty())
{
std::string ofname = this->Makefile->GetCurrentOutputDirectory();
@@ -2475,7 +2475,7 @@ bool cmLocalGeneratorCheckObjectName(std::string& objName,
std::string&
cmLocalGenerator
::CreateSafeUniqueObjectFileName(const char* sin,
- std::string::size_type dir_len)
+ std::string const& dir_max)
{
// Look for an existing mapped name for this object file.
std::map<cmStdString,cmStdString>::iterator it =
@@ -2536,9 +2536,10 @@ cmLocalGenerator
}
#if defined(CM_LG_ENCODE_OBJECT_NAMES)
- cmLocalGeneratorCheckObjectName(ssin, dir_len, this->ObjectPathMax);
+ cmLocalGeneratorCheckObjectName(ssin, dir_max.size(),
+ this->ObjectPathMax);
#else
- (void)dir_len;
+ (void)dir_max;
#endif
// Insert the newly mapped object file name.
@@ -2554,7 +2555,7 @@ cmLocalGenerator
std::string
cmLocalGenerator
::GetObjectFileNameWithoutTarget(const cmSourceFile& source,
- std::string::size_type dir_len,
+ std::string const& dir_max,
bool* hasSourceExtension)
{
// Construct the object file name using the full path to the source
@@ -2642,7 +2643,7 @@ cmLocalGenerator
}
// Convert to a safe name.
- return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_len);
+ return this->CreateSafeUniqueObjectFileName(objectName.c_str(), dir_max);
}
//----------------------------------------------------------------------------