diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-12-02 11:29:31 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-12-03 14:06:33 (GMT) |
commit | f395caf49845dc233c31dd92eaaacaa4f16a1241 (patch) | |
tree | 0c9639ebbc8435754459396732c340777e32b6a2 | |
parent | 8bdde2b161979ba61f41bfce2bdba1bb38cdcb04 (diff) | |
download | CMake-f395caf49845dc233c31dd92eaaacaa4f16a1241.zip CMake-f395caf49845dc233c31dd92eaaacaa4f16a1241.tar.gz CMake-f395caf49845dc233c31dd92eaaacaa4f16a1241.tar.bz2 |
Makefiles dependencies: enhance robustness of deps parser
-rw-r--r-- | Source/cmDependsCompiler.cxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index eb0f1d5..0f695c8 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -182,6 +182,11 @@ bool cmDependsCompiler::CheckDependencies( ParseLine(line, depends); } + if (depends.empty()) { + // unexpectedly empty, ignore it and continue + continue; + } + // depending of the effective format of the dependencies file generated // by the compiler, the target can be wrongly identified as a // dependency so remove it from the list @@ -189,7 +194,13 @@ bool cmDependsCompiler::CheckDependencies( depends.erase(depends.begin()); } - if (isValidPath) { + // ensure source file is the first dependency + if (depends.front() != source) { + cm::erase(depends, source); + if (!isValidPath) { + depends.insert(depends.begin(), source); + } + } else if (isValidPath) { // remove first dependency because it must not be filtered out depends.erase(depends.begin()); } |