diff options
Diffstat (limited to 'Source/cmDependsCompiler.cxx')
-rw-r--r-- | Source/cmDependsCompiler.cxx | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Source/cmDependsCompiler.cxx b/Source/cmDependsCompiler.cxx index 0cc4946..c8061c3 100644 --- a/Source/cmDependsCompiler.cxx +++ b/Source/cmDependsCompiler.cxx @@ -128,7 +128,7 @@ bool cmDependsCompiler::CheckDependencies( } std::string line; - if (!isValidPath) { + if (!isValidPath && !source.empty()) { // insert source as first dependency depends.push_back(source); } @@ -158,14 +158,16 @@ bool cmDependsCompiler::CheckDependencies( } // ensure source file is the first dependency - if (depends.front() != source) { - cm::erase(depends, source); - if (!isValidPath) { - depends.insert(depends.begin(), source); + if (!source.empty()) { + 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()); } - } else if (isValidPath) { - // remove first dependency because it must not be filtered out - depends.erase(depends.begin()); } } else { // unknown format, ignore it @@ -174,8 +176,10 @@ bool cmDependsCompiler::CheckDependencies( if (isValidPath) { cm::erase_if(depends, isValidPath); - // insert source as first dependency - depends.insert(depends.begin(), source); + if (!source.empty()) { + // insert source as first dependency + depends.insert(depends.begin(), source); + } } dependencies[target] = std::move(depends); |