summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-03-26 13:25:09 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-03-26 13:25:15 (GMT)
commite0c3b9268b0e45010c405cfc69bbaf1410fbd3eb (patch)
treedd32949b5eb592f3bbf846c9cbc6d1018eaa6f10 /Source
parent03f2aad7b1af478a5afea06a59c5ef119c4761d8 (diff)
parent2fe39dc30614f8fd7d0c37a68e8e7e3eb20f445a (diff)
downloadCMake-e0c3b9268b0e45010c405cfc69bbaf1410fbd3eb.zip
CMake-e0c3b9268b0e45010c405cfc69bbaf1410fbd3eb.tar.gz
CMake-e0c3b9268b0e45010c405cfc69bbaf1410fbd3eb.tar.bz2
Merge topic 'windows-long-path'
2fe39dc306 cmake: Fix loading CMake sources from long paths on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5940
Diffstat (limited to 'Source')
-rw-r--r--Source/cmListFileCache.cxx12
1 files changed, 11 insertions, 1 deletions
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index 1464a14..5c3a034 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -7,6 +7,10 @@
#include <sstream>
#include <utility>
+#ifdef _WIN32
+# include <cmsys/Encoding.hxx>
+#endif
+
#include "cmListFileLexer.h"
#include "cmMessageType.h"
#include "cmMessenger.h"
@@ -83,9 +87,15 @@ bool cmListFileParser::ParseFile(const char* filename)
{
this->FileName = filename;
+#ifdef _WIN32
+ std::string expandedFileName = cmsys::Encoding::ToNarrow(
+ cmSystemTools::ConvertToWindowsExtendedPath(filename));
+ filename = expandedFileName.c_str();
+#endif
+
// Open the file.
cmListFileLexer_BOM bom;
- if (!cmListFileLexer_SetFileName(this->Lexer, this->FileName, &bom)) {
+ if (!cmListFileLexer_SetFileName(this->Lexer, filename, &bom)) {
this->IssueFileOpenError("cmListFileCache: error can not open file.");
return false;
}