1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-13 00:56:08 +08:00

5 Commits

Author SHA1 Message Date
Michael Hirsch
ad4481fa00
Source: Enhance check for C++17 filesystem support
* Add `lexically_normal` test for all platforms.

* On Windows, MinGW does not currently handle `lexically_normal()`
  correctly on UNC path, but MSVC and IntelLLVM do--add a comment
  on this to avoid future confusion.

* Add test with `\\?\` notation and `weakly_canonical` that also triggers
  the MinGW bug, but is fine with MSVC and oneAPI, for a more robust and
  comprehensive test.
2023-12-05 11:30:08 -05:00
Marc Chevrier
40af103402 cmCMakePath: do not use std::filesystem::path with RH gcc-toolset-10
Fixes: #25458, #25453
2023-12-04 17:39:06 +01:00
Brad King
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17
The `remove_filename` and `replace_extension` methods compute an offset
between the whole path in a `std::string` and a part of a path in a
`std::string_view`.  This is done by subtracting their `.data()`
pointers.  However, C++17 adds a non-const `.data()` through which
modification of the string is allowed.  This means the copy-on-write
implementation used by the pre-C++11 std::string GNU ABI must reallocate
if the string has been copied.  Our subtraction then computes an offset
between two different allocations, which is undefined behavior.

The workaround in commit b3ca4f9ad1 (cm/filesystem: Work around crash
when compiled for CYGWIN/MSYS runtime, 2021-04-22, v3.21.0-rc1~271^2~2)
avoided the problem by calling the non-const `.data()` to reallocate
before constructing the `string_view`.  Instead, explicitly call the
const `.data()` method on the string, which does not reallocate.

Fixes: #22090, #23328
2022-10-20 18:31:50 -04:00
Marc Chevrier
eb583b0a66 cmake_path command: path management
Fixes: #19568, #20922
2020-09-06 10:52:25 +02:00
Marc Chevrier
d654bf3449 STL Support: Add cm::filesystem::path in <cm/filesystem> 2020-07-09 17:02:42 +02:00