Pre-compute object file names before Makefile generation

Add a virtual cmGlobalGenerator::ComputeTargetObjects method invoked
during cmGeneratorTarget construction.  Implement it in the Makefile
generator to pre-compute all object file names for each target.  Use
the results during generation instead of re-computing it later.
This commit is contained in:
Brad King
2012-03-07 14:01:46 -05:00
parent 62a841b80b
commit 3baaf6ccec
8 changed files with 50 additions and 55 deletions
-39
View File
@@ -2008,45 +2008,6 @@ void cmLocalUnixMakefileGenerator3
}
}
//----------------------------------------------------------------------------
std::string
cmLocalUnixMakefileGenerator3
::GetObjectFileName(cmTarget& target,
const cmSourceFile& source,
std::string* nameWithoutTargetDir,
bool* hasSourceExtension)
{
// Make sure we never hit this old case.
if(source.GetProperty("MACOSX_PACKAGE_LOCATION"))
{
std::string msg = "MACOSX_PACKAGE_LOCATION set on source file: ";
msg += source.GetFullPath();
this->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR,
msg.c_str());
}
// Start with the target directory.
std::string obj = this->GetTargetDirectory(target);
obj += "/";
// Get the object file name without the target directory.
std::string dir_max;
dir_max += this->Makefile->GetCurrentOutputDirectory();
dir_max += "/";
dir_max += obj;
std::string objectName =
this->GetObjectFileNameWithoutTarget(source, dir_max,
hasSourceExtension);
if(nameWithoutTargetDir)
{
*nameWithoutTargetDir = objectName;
}
// Append the object name to the target directory.
obj += objectName;
return obj;
}
//----------------------------------------------------------------------------
void cmLocalUnixMakefileGenerator3::WriteDisclaimer(std::ostream& os)
{