mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
@@ -12,6 +12,8 @@
|
|||||||
#include "LexerParser/cmGccDepfileLexer.h"
|
#include "LexerParser/cmGccDepfileLexer.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
# include <cctype>
|
||||||
|
|
||||||
# include "cmsys/Encoding.h"
|
# include "cmsys/Encoding.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -123,11 +125,21 @@ void cmGccDepfileLexerHelper::sanitizeContent()
|
|||||||
if (it->rules.empty()) {
|
if (it->rules.empty()) {
|
||||||
it = this->Content.erase(it);
|
it = this->Content.erase(it);
|
||||||
} else {
|
} else {
|
||||||
// Remove empty paths
|
// Remove empty paths and normalize windows paths
|
||||||
for (auto pit = it->paths.begin(); pit != it->paths.end();) {
|
for (auto pit = it->paths.begin(); pit != it->paths.end();) {
|
||||||
if (pit->empty()) {
|
if (pit->empty()) {
|
||||||
pit = it->paths.erase(pit);
|
pit = it->paths.erase(pit);
|
||||||
} else {
|
} 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;
|
++pit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user