diff options
author | tsecer harry <tsecer@163.com> | 2018-03-20 07:59:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-03-20 12:40:04 (GMT) |
commit | 8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6 (patch) | |
tree | a858ebbc81351b3c6f0bdba066d153f5eedb0d26 /Source/cmDependsC.cxx | |
parent | 882ba7fd11d375ceb5dec433af79b63057907bcb (diff) | |
download | CMake-8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6.zip CMake-8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6.tar.gz CMake-8c0f12c4aa4d3b6a83ea663f27d1affed61abcf6.tar.bz2 |
Makefile: Restore use of dependency scanning cache
Since commit v2.8.0~27 (Major optimization of C/C++ dependency scanning,
2009-09-23) our `VaildDeps` cache of `depend.internal` content is
supposed to avoid re-scanning dependencies of object files whose
dependencies have not changed. However, this was broken by changes to
`cmDependsC::WriteDependencies` by commit v3.1.0-rc1~272^2~1 (cmDepends:
Refactor object file path conversion, 2014-07-22). The object file path
written to `depend.internal` was changed to a relative path, but the
lookup in the `ValidDeps` cache of that information was not updated too.
Therefore the cache is not used.
Fix the object file path used for the `ValidDeps` lookup to restore the
original optimization.
Diffstat (limited to 'Source/cmDependsC.cxx')
-rw-r--r-- | Source/cmDependsC.cxx | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx index 62bc8d9..34c0e94 100644 --- a/Source/cmDependsC.cxx +++ b/Source/cmDependsC.cxx @@ -96,9 +96,16 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, std::set<std::string> dependencies; bool haveDeps = false; + std::string binDir = this->LocalGenerator->GetBinaryDirectory(); + + // Compute a path to the object file to write to the internal depend file. + // Any existing content of the internal depend file has already been + // loaded in ValidDeps with this path as a key. + std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); + if (this->ValidDeps != nullptr) { std::map<std::string, DependencyVector>::const_iterator tmpIt = - this->ValidDeps->find(obj); + this->ValidDeps->find(obj_i); if (tmpIt != this->ValidDeps->end()) { dependencies.insert(tmpIt->second.begin(), tmpIt->second.end()); haveDeps = true; @@ -222,8 +229,6 @@ bool cmDependsC::WriteDependencies(const std::set<std::string>& sources, // written by the original local generator for this directory // convert the dependencies to paths relative to the home output // directory. We must do the same here. - std::string binDir = this->LocalGenerator->GetBinaryDirectory(); - std::string obj_i = this->LocalGenerator->ConvertToRelativePath(binDir, obj); std::string obj_m = cmSystemTools::ConvertToOutputPath(obj_i); internalDepends << obj_i << std::endl; |