diff options
author | Brad King <brad.king@kitware.com> | 2021-04-01 14:19:50 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-04-01 14:19:58 (GMT) |
commit | 369d5c2bcfe3e9adcd9ab9ff130888455acc66a5 (patch) | |
tree | 476a9d46bc95cabd0536a285678d1ba0badc3842 /Source | |
parent | 36f1f7c449a4b213b207032a32082d78fd866348 (diff) | |
parent | 1b346350af4cc1b2d66c03b76ced8226724399fd (diff) | |
download | CMake-369d5c2bcfe3e9adcd9ab9ff130888455acc66a5.zip CMake-369d5c2bcfe3e9adcd9ab9ff130888455acc66a5.tar.gz CMake-369d5c2bcfe3e9adcd9ab9ff130888455acc66a5.tar.bz2 |
Merge topic 'make-fix-deps-paths' into release-3.20
1b346350af Makefiles dependencies: normalize windows paths
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5955
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGccDepfileLexerHelper.cxx | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmGccDepfileLexerHelper.cxx b/Source/cmGccDepfileLexerHelper.cxx index c782bcd..afa8e9b 100644 --- a/Source/cmGccDepfileLexerHelper.cxx +++ b/Source/cmGccDepfileLexerHelper.cxx @@ -12,6 +12,8 @@ #include "LexerParser/cmGccDepfileLexer.h" #ifdef _WIN32 +# include <cctype> + # include "cmsys/Encoding.h" #endif @@ -123,11 +125,21 @@ void cmGccDepfileLexerHelper::sanitizeContent() if (it->rules.empty()) { it = this->Content.erase(it); } else { - // Remove empty paths + // Remove empty paths and normalize windows paths for (auto pit = it->paths.begin(); pit != it->paths.end();) { if (pit->empty()) { pit = it->paths.erase(pit); } else { +#if defined(_WIN32) + // Unescape the colon following the drive letter. + // Some versions of GNU compilers can escape this character. + // c\:\path must be transformed to c:\path + if (pit->size() >= 3 && std::toupper((*pit)[0]) >= 'A' && + std::toupper((*pit)[0]) <= 'Z' && (*pit)[1] == '\\' && + (*pit)[2] == ':') { + pit->erase(1, 1); + } +#endif ++pit; } } |