diff options
author | Brad King <brad.king@kitware.com> | 2012-03-07 19:01:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2012-03-09 20:16:02 (GMT) |
commit | 3baaf6ccecb9117b613fc89cd37206960298dfaa (patch) | |
tree | 12e5a8e3b6df8faed7a386500768f008f6cf3ce6 /Source/cmGlobalUnixMakefileGenerator3.cxx | |
parent | 62a841b80b5f4b4f9cc0ddba77ae010a29b0e27e (diff) | |
download | CMake-3baaf6ccecb9117b613fc89cd37206960298dfaa.zip CMake-3baaf6ccecb9117b613fc89cd37206960298dfaa.tar.gz CMake-3baaf6ccecb9117b613fc89cd37206960298dfaa.tar.bz2 |
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.
Diffstat (limited to 'Source/cmGlobalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmGlobalUnixMakefileGenerator3.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index a23c0d8..059692e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -17,6 +17,7 @@ #include "cmGeneratedFileStream.h" #include "cmSourceFile.h" #include "cmTarget.h" +#include "cmGeneratorTarget.h" cmGlobalUnixMakefileGenerator3::cmGlobalUnixMakefileGenerator3() { @@ -71,6 +72,37 @@ void cmGlobalUnixMakefileGenerator3 } //---------------------------------------------------------------------------- +void +cmGlobalUnixMakefileGenerator3 +::ComputeTargetObjects(cmGeneratorTarget* gt) const +{ + cmTarget* target = gt->Target; + cmLocalUnixMakefileGenerator3* lg = + static_cast<cmLocalUnixMakefileGenerator3*>(gt->LocalGenerator); + + // Compute full path to object file directory for this target. + std::string dir_max; + dir_max += gt->Makefile->GetCurrentOutputDirectory(); + dir_max += "/"; + dir_max += gt->LocalGenerator->GetTargetDirectory(*target); + dir_max += "/"; + + // Compute the name of each object file. + for(std::vector<cmSourceFile*>::iterator + si = gt->ObjectSources.begin(); + si != gt->ObjectSources.end(); ++si) + { + cmSourceFile* sf = *si; + bool hasSourceExtension = true; + std::string objectName = gt->LocalGenerator + ->GetObjectFileNameWithoutTarget(*sf, dir_max, + &hasSourceExtension); + gt->Objects[sf] = objectName; + lg->AddLocalObjectFile(target, sf, objectName, hasSourceExtension); + } +} + +//---------------------------------------------------------------------------- std::string EscapeJSON(const std::string& s) { std::string result; for (std::string::size_type i = 0; i < s.size(); ++i) { |