1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-08 22:37:04 +08:00

47 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
Marc Chevrier
4d48958965 enum_set enhancements, step 3 2025-02-14 10:38:34 +01:00
Marc Chevrier
77ab2446d4 enum_set enhancements, step 2
* remove support of size computation based on "magic" enum element because
  Oracle SunPro compilers crash on it.
* enhance handling of enum_set with explicit size.
2025-01-31 19:14:36 +01:00
Marc Chevrier
35dafcb5a1 cmext/enum_set: add various enhancements to increase usability 2025-01-29 16:42:52 +01:00
Marc Chevrier
a3ae58c9c5 C++ features: add cm::is_scoped_enum from C++23 2025-01-28 17:52:36 +01: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
Kitware Robot
b2ba64add9 Revise C++ coding style using clang-format-18
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  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.

Fixes: #26123
2025-01-23 11:43:06 -05:00
Vito Gamberini
e0f9d81f09
STL: extend type_traits to deal with member pointers 2024-07-02 09:30:55 -04:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Kyle Edwards
3b6c5efc08 cm::append: Add support for std::basic_string on SPARC/SunPro 2023-06-14 11:53:55 -04:00
Kitware Robot
33abef7416 Revise C++ coding style using clang-format-15
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 15.

* 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.

Fixes: #24315
2023-01-18 16:20:47 -05:00
Brad King
7c71f9b1e8 Merge topic 'filesystem-path-c++03-abi'
ee9805ccd1 cm/filesystem: Fix crash with pre-C++11 std::string GNU ABI in C++17

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7813
2022-10-21 10:06:22 -04: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
02c067dee5 cm::enum_set: fix various bugs 2022-08-22 16:25:53 +02:00
Marc Chevrier
95a1b2c7b8 stl containers: enhance compatibility with C++14, C++17 and C++20
* Ensure various functions working with containers are available through
all headers as specified by the standard.
* Add C++20 std::ssize() function.
2022-05-07 11:04:06 +02:00
Marc Chevrier
f42d0c9322 cm::enum_set: fix compilation warning 2022-04-29 16:49:14 +02:00
Marc Chevrier
b13eef5a90 cm::enum_set: container that contains a set of unique enum values.
The enum must be an `enum class` with an unsigned integer as base type.
2022-04-27 19:40:40 +02: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
Brad King
b7d4ee23d8 cm::optional: Fix -Wunused-parameter warnings in comparison operators 2021-01-25 14:44:09 -05:00
Kyle Edwards
67383725bd cm::optional: Add constructor delegation to nullopt_t constructor
Some static analysis tools incorrectly identify this constructor
as leaving _has_value in an undefined state. Explicitly call the
default constructor to force _has_value to false.
2020-10-22 11:40:48 -04:00
Kyle Edwards
0668120398 cm::optional: Fix move assignment 2020-10-21 14:23:43 -04:00
Marc Chevrier
82c9508313 cmake_path: enhancements
* Fix error on parsing "c:a" (root-name without root-directory)
* Enrich documentation
2020-09-20 15:17:34 +02:00
Kyle Edwards
1d74a64f38 Merge topic 'cm-optional-comparison'
7e1304c6e6 cm::optional: Add comparison operators
c854e9eba5 Refactor: Add ASSERT_TRUE() macro to testOptional.cxx

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5195
2020-09-08 09:55:18 -04:00
Kyle Edwards
7e1304c6e6 cm::optional: Add comparison operators 2020-09-07 08:50:09 -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
Fred Baksik
bfed613132 STL Support: Fix cm::filesystem warnings; check for '\' not multichar ' \'.
Utilities/std/cm/bits/fs_path.cxx:334:24: warning: multi-character character constant [-Wmultichar]
             || *ptr == ' \\'
                        ^~~~~
2020-07-24 19:36:46 -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
Marc Chevrier
e5798126fc STL Support: introduce dedicated configuration file 2020-07-09 15:24:43 +02:00
Marc Chevrier
4408f34cfe STL Support: Add function cm::quoted in <cm/iomanip> 2020-07-09 15:24:43 +02:00
Sumit Bhardwaj
782d7387d5 Implement cm::static_reference_cast by declval
Previously, cm::static_reference_cast used invoke_result_t and took the
address of O::get. This is not in complete conformance with standard.

This MR changes the implementation to use std::declval<O>.get() which is
always well-defined.
2020-07-04 11:03:46 -07:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Marc Chevrier
8d4a9ee398 Refactoring: rename "cm_static_string_view.hxx" as <cmext/string_view> 2020-04-30 09:53:27 +02:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Marc Chevrier
f034b0f663 CMake compilation: do not use compiler extensions
For now, compiler extensions are no longer activated on CMake sources.
However these extensions are still used for various third parties.

This MR is a partial answer to the issue #20454.
2020-03-23 10:29:58 +01:00
Marc Chevrier
fa828b8fba STL support: make_unique can now handle array 2020-01-28 17:38:17 +01:00
Marc Chevrier
73d1da4f86 Stl support: cm::append now supports any sequential container 2020-01-24 15:55:32 +01:00
Marc Chevrier
b9a3f2e7e2 STL Support: enhance behavior of cm::dynamic_reference_cast
Ensure cm::dynamic_reference_cast has same behavior as dynamic_cast
on reference: raise std::bad_cast if dynamic_cast is not possible.
2020-01-17 11:09:53 +01:00
Marc Chevrier
04c2f67492 STL Support: extends type_traits for future developments 2020-01-17 11:09:48 +01:00
Marc Chevrier
348b60d19d STL support: add c++20 std::erase and std::erase_if functions 2020-01-08 17:35:16 +01:00
Marc Chevrier
a38d04c076 Refactoring: introduce header cmext/algorithm with append functions 2019-12-17 10:43:58 +01:00
Marc Chevrier
fc3b4caa2e Memory management: cast functions for managed pointers 2019-11-27 16:03:04 +01:00
Kitware Robot
ed98209ddc Revise include order using clang-format-6.0
Run the `clang-format.bash` script to update our C and C++ code to a new
include order `.clang-format`.  Use `clang-format` version 6.0.
2019-10-01 12:26:36 -04:00
Regina Pfeifer
6a05bd3fa6 cm/algorithm: Provide function cm::clamp 2019-09-25 10:30:58 +02:00
Marc Chevrier
4a08690ccf cmstd: Extend header <cm/iterator> 2019-09-20 10:01:56 -04:00
Marc Chevrier
c688b401d3 cmstd: Modernize CMake system headers
Provide a standardized way to handle the C++ "standard" headers
customized to be used with current CMake C++ standard constraints.
Offer under directory `cm` headers which can be used as direct
replacements of the standard ones.  For example:

    #include <cm/string_view>

can be used safely for CMake development in place of the `<string_view>`
standard header.

Fixes: #19491
2019-09-20 10:01:37 -04:00