diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2023-04-19 16:01:10 +0200 |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2023-05-03 17:08:07 +0200 |
commit | 375e6fdbbe398921de321216125765ba1917a325 (patch) | |
tree | 43d934f18f4d28a82d5264a0d0fb0301bc0bf7d9 /Source/cmDependsCompiler.cxx | |
parent | 24a3e5cda049138ca178216e0d7b02262e4035ed (diff) | |
download | cmake-375e6fdbbe398921de321216125765ba1917a325.tar.gz |
Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051)
Fixes: #22217
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 0cc4946e48..c8061c36ee 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); |