mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-13 12:59:55 -05:00
Makefiles dependencies: enhance robustness of deps parser
This commit is contained in:
@@ -182,6 +182,11 @@ bool cmDependsCompiler::CheckDependencies(
|
|||||||
ParseLine(line, depends);
|
ParseLine(line, depends);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (depends.empty()) {
|
||||||
|
// unexpectedly empty, ignore it and continue
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// depending of the effective format of the dependencies file generated
|
// depending of the effective format of the dependencies file generated
|
||||||
// by the compiler, the target can be wrongly identified as a
|
// by the compiler, the target can be wrongly identified as a
|
||||||
// dependency so remove it from the list
|
// dependency so remove it from the list
|
||||||
@@ -189,7 +194,13 @@ bool cmDependsCompiler::CheckDependencies(
|
|||||||
depends.erase(depends.begin());
|
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
|
// remove first dependency because it must not be filtered out
|
||||||
depends.erase(depends.begin());
|
depends.erase(depends.begin());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user