summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-12-07 14:12:31 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-12-07 14:12:43 (GMT)
commitf0539c353c20e75e9ce2098f4f50890245cb2732 (patch)
treeb138913a681a4d8dd8c6f8a78152a181b26f1373
parent3a7c42fdd9acbe5f23458c1560c4523525718aa9 (diff)
parentad4481fa00369f8ce043d326daf80bb349b0c99a (diff)
downloadCMake-f0539c353c20e75e9ce2098f4f50890245cb2732.zip
CMake-f0539c353c20e75e9ce2098f4f50890245cb2732.tar.gz
CMake-f0539c353c20e75e9ce2098f4f50890245cb2732.tar.bz2
Merge topic 'win-fs'
ad4481fa00 Source: Enhance check for C++17 filesystem support Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9028
-rw-r--r--Source/Checks/cm_cxx_filesystem.cxx11
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Checks/cm_cxx_filesystem.cxx b/Source/Checks/cm_cxx_filesystem.cxx
index c8df589..bdc7c6d 100644
--- a/Source/Checks/cm_cxx_filesystem.cxx
+++ b/Source/Checks/cm_cxx_filesystem.cxx
@@ -9,12 +9,13 @@ int main()
std::filesystem::path p0(L"/a/b/c");
std::filesystem::path p1("/a/b/c");
- std::filesystem::path p2("/a/b/c");
- if (p1 != p2) {
+ std::filesystem::path p2("/a/b//c");
+ if (p1 != p2.lexically_normal()) {
return 1;
}
#if defined(_WIN32)
+ // "//host/" is not preserved in some environments like GNU under MinGW.
std::filesystem::path p3("//host/a/b/../c");
if (p3.lexically_normal().generic_string() != "//host/a/c") {
return 1;
@@ -24,6 +25,12 @@ int main()
if (p4.lexically_normal().generic_string() != "c:/a/") {
return 1;
}
+
+ std::filesystem::path b1("C:\\path\\y\\..\\");
+ if (std::filesystem::weakly_canonical("\\\\?\\C:\\path\\x\\..") !=
+ b1.lexically_normal()) {
+ return 1;
+ }
#endif
// If std::string is copy-on-write, the std::filesystem::path