1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-09 23:08:18 +08:00

8 Commits

Author SHA1 Message Date
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05: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
Brad King
b3ca4f9ad1 cm/filesystem: Work around crash when compiled for CYGWIN/MSYS runtime
Issue: #22090
2021-04-26 14:27:34 -04:00
Marc Chevrier
212e953d35 cmCMakePath: Class for path handling 2020-09-06 10:34:17 +02:00
Kitware Robot
bdca8b01d2 Modernize: Use #pragma once in all header files
#pragma once is a widely supported compiler pragma, even though it is
not part of the C++ standard. Many of the issues keeping #pragma once
from being standardized (distributed filesystems, build farms, hard
links, etc.) do not apply to CMake - it is easy to build CMake on a
single machine. CMake also does not install any header files which can
be consumed by other projects (though cmCPluginAPI.h has been
deliberately omitted from this conversion in case anyone is still using
it.) Finally, #pragma once has been required to build CMake since at
least August 2017 (7f29bbe6 enabled server mode unconditionally, which
had been using #pragma once since September 2016 (b13d3e0d)). The fact
that we now require C++11 filters out old compilers, and it is unlikely
that there is a compiler which supports C++11 but does not support
#pragma once.
2020-09-03 09:30:21 -04:00
Marc Chevrier
259356f3b5 STL Support: cm::filesystem::path: add support of Cygwin 2020-07-20 16:20:42 +02:00
Marc Chevrier
d654bf3449 STL Support: Add cm::filesystem::path in <cm/filesystem> 2020-07-09 17:02:42 +02:00