summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/cmLocalGenerator.cxx19
-rw-r--r--Source/cmLocalGenerator.h4
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx10
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx22
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx32
5 files changed, 44 insertions, 43 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);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 9af44c9..0f4c1e9 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -340,10 +340,10 @@ protected:
// Compute object file names.
std::string GetObjectFileNameWithoutTarget(const cmSourceFile& source,
- std::string::size_type dir_len,
+ std::string const& dir_max,
bool* hasSourceExtension = 0);
std::string& CreateSafeUniqueObjectFileName(const char* sin,
- std::string::size_type dir_len);
+ std::string const& dir_max);
void ConfigureRelativePaths();
std::string FindRelativePathTopSource();
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index aae96ab..9517cd8 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -1928,12 +1928,12 @@ cmLocalUnixMakefileGenerator3
obj += "/";
// Get the object file name without the target directory.
- std::string::size_type dir_len = 0;
- dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
- dir_len += 1;
- dir_len += obj.size();
+ std::string dir_max;
+ dir_max += this->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ dir_max += obj;
std::string objectName =
- this->GetObjectFileNameWithoutTarget(source, dir_len,
+ this->GetObjectFileNameWithoutTarget(source, dir_max,
hasSourceExtension);
if(nameWithoutTargetDir)
{
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index c00cdea..3493719 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -372,27 +372,27 @@ void cmLocalVisualStudio6Generator
this->WriteDSPBeginGroup(fout, name.c_str(), "");
}
- // Compute the maximum length of a configuration name.
- std::string::size_type config_len_max = 0;
+ // Compute the maximum length configuration name.
+ std::string config_max;
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
// Strip the subdirectory name out of the configuration name.
std::string config = this->GetConfigName(*i);
- if(config.size() > config_len_max)
+ if(config.size() > config_max.size())
{
- config_len_max = config.size();
+ config_max = config;
}
}
- // Compute the maximum length of the full path to the intermediate
+ // Compute the maximum length full path to the intermediate
// files directory for any configuration. This is used to construct
// object file names that do not produce paths that are too long.
- std::string::size_type dir_len = 0;
- dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
- dir_len += 1;
- dir_len += config_len_max;
- dir_len += 1;
+ std::string dir_max;
+ dir_max += this->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ dir_max += config_max;
+ dir_max += "/";
// Loop through each source in the source group.
for(std::vector<const cmSourceFile *>::const_iterator sf =
@@ -408,7 +408,7 @@ void cmLocalVisualStudio6Generator
{
objectNameDir =
cmSystemTools::GetFilenamePath(
- this->GetObjectFileNameWithoutTarget(*(*sf), dir_len));
+ this->GetObjectFileNameWithoutTarget(*(*sf), dir_max));
}
// Add per-source file flags.
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 2093099..2c92579 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1226,7 +1226,7 @@ public:
cmTarget& target,
cmSourceFile const& sf,
std::vector<std::string>* configs,
- std::string::size_type dir_len);
+ std::string const& dir_max);
std::map<cmStdString, cmLVS7GFileConfig> FileConfigMap;
};
@@ -1235,12 +1235,12 @@ cmLocalVisualStudio7GeneratorFCInfo
cmTarget& target,
cmSourceFile const& sf,
std::vector<std::string>* configs,
- std::string::size_type dir_len)
+ std::string const& dir_max)
{
std::string objectName;
if(lg->NeedObjectName.find(&sf) != lg->NeedObjectName.end())
{
- objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_len);
+ objectName = lg->GetObjectFileNameWithoutTarget(sf, dir_max);
}
// Compute per-source, per-config information.
@@ -1358,27 +1358,27 @@ void cmLocalVisualStudio7Generator
this->WriteVCProjBeginGroup(fout, name.c_str(), "");
}
- // Compute the maximum length of a configuration name.
- std::string::size_type config_len_max = 0;
+ // Compute the maximum length configuration name.
+ std::string config_max;
for(std::vector<std::string>::iterator i = configs->begin();
i != configs->end(); ++i)
{
- if(i->size() > config_len_max)
+ if(i->size() > config_max.size())
{
- config_len_max = i->size();
+ config_max = *i;
}
}
- // Compute the maximum length of the full path to the intermediate
+ // Compute the maximum length full path to the intermediate
// files directory for any configuration. This is used to construct
// object file names that do not produce paths that are too long.
- std::string::size_type dir_len = 0;
- dir_len += strlen(this->Makefile->GetCurrentOutputDirectory());
- dir_len += 1;
- dir_len += this->GetTargetDirectory(target).size();
- dir_len += 1;
- dir_len += config_len_max;
- dir_len += 1;
+ std::string dir_max;
+ dir_max += this->Makefile->GetCurrentOutputDirectory();
+ dir_max += "/";
+ dir_max += this->GetTargetDirectory(target);
+ dir_max += "/";
+ dir_max += config_max;
+ dir_max += "/";
// Loop through each source in the source group.
std::string objectName;
@@ -1386,7 +1386,7 @@ void cmLocalVisualStudio7Generator
sourceFiles.begin(); sf != sourceFiles.end(); ++sf)
{
std::string source = (*sf)->GetFullPath();
- FCInfo fcinfo(this, target, *(*sf), configs, dir_len);
+ FCInfo fcinfo(this, target, *(*sf), configs, dir_max);
if (source != libName || target.GetType() == cmTarget::UTILITY ||
target.GetType() == cmTarget::GLOBAL_TARGET )