summaryrefslogtreecommitdiffstats
path: root/Source/cmGccDepfileLexerHelper.cxx
diff options
context:
space:
mode:
authorMarc Chevrier <marc.chevrier@gmail.com>2023-04-19 14:01:10 (GMT)
committerMarc Chevrier <marc.chevrier@gmail.com>2023-05-03 15:08:07 (GMT)
commit375e6fdbbe398921de321216125765ba1917a325 (patch)
tree43d934f18f4d28a82d5264a0d0fb0301bc0bf7d9 /Source/cmGccDepfileLexerHelper.cxx
parent24a3e5cda049138ca178216e0d7b02262e4035ed (diff)
downloadCMake-375e6fdbbe398921de321216125765ba1917a325.zip
CMake-375e6fdbbe398921de321216125765ba1917a325.tar.gz
CMake-375e6fdbbe398921de321216125765ba1917a325.tar.bz2
Link step: use linker dependency linker file
Based on work done by @ben.boeckel (!8051) Fixes: #22217
Diffstat (limited to 'Source/cmGccDepfileLexerHelper.cxx')
-rw-r--r--Source/cmGccDepfileLexerHelper.cxx6
1 files changed, 6 insertions, 0 deletions
diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx
index 34c8824..87377de 100644
--- a/Source/cmGccDepfileLexerHelper.cxx
+++ b/Source/cmGccDepfileLexerHelper.cxx
@@ -2,6 +2,7 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmGccDepfileLexerHelper.h"
+#include <algorithm>
#include <cstdio>
#include <memory>
#include <string>
@@ -113,6 +114,11 @@ void cmGccDepfileLexerHelper::addToCurrentPath(const char* s)
void cmGccDepfileLexerHelper::sanitizeContent()
{
for (auto it = this->Content.begin(); it != this->Content.end();) {
+ // remove duplicate path entries
+ std::sort(it->paths.begin(), it->paths.end());
+ auto last = std::unique(it->paths.begin(), it->paths.end());
+ it->paths.erase(last, it->paths.end());
+
// Remove empty paths and normalize windows paths
for (auto pit = it->paths.begin(); pit != it->paths.end();) {
if (pit->empty()) {