Commit Graph

32 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
Daniel Pfeifer
58c5f77837 clang-tidy: fix readability-redundant-* warnings 2024-10-11 15:37:21 +02:00
Ben Boeckel
a820877d03 errors: avoid constructing a stream before getting the last error
Constructing a stream may involve operations that change the global
error state. Avoid the streams by using `cmStrCat` instead.
2023-12-01 22:58:05 -05:00
Ben Boeckel
5cf7018af6 cmFileCopier: remember error statuses and get their strings
The last error may have changed between the original call and the
`GetLastSystemError()` call. Remember the status explicitly and ask it
for its error string.

Reported on Discourse: https://discourse.cmake.org/t/9539
2023-12-01 22:58:05 -05:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
John Parent
569fb1893e file(INSTALL): Report "Installing:" for a symlink to a directory 2022-10-06 15:10:23 -04:00
John Parent
1461ae4933 file(INSTALL): Clarify symlink vs dir conflict errors
Clarify error reporting in scenario creating a symlink where a directory
previously exists.
2022-10-06 15:10:05 -04:00
Brad King
85f01a1ec2 file(INSTALL): Improve formatting of symlink creation error
Avoid printing two error messages.  Format paths without wrapping.
2022-10-06 15:08:06 -04:00
Ben Boeckel
a5f8cbe8b1 clang-tidy: address modernize-use-default-member-init lints 2022-05-24 09:09:43 -04:00
Brad King
3c855b167f Merge topic 'fix-ifdef-windows'
40e73c5ac4 Source: Fix typo in _WIN32 preprocessor checks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6631
2021-10-18 09:29:20 -04:00
Brad King
40e73c5ac4 Source: Fix typo in _WIN32 preprocessor checks
Since CMake's default compiler flags with MSVC include `-DWIN32` for
historical reasons, a few preprocessor conditions were accidentally
checking for `WIN32` instead of `_WIN32`.  The corresponding blocks
were left out when compiling official binaries for `cmake.org` because
we hard-code compiler flags without `-DWIN32`.

Fixes: #22764
2021-10-15 11:39:04 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Vitaly Stakhovsky
f37c14e930 Source: use cmNonempty() 2020-07-28 08:31:31 -04: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
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Brad King
37c671570c Merge topic 'source_sweep_ostringstream_single'
3b2b02825d Source sweep: Replace std::ostringstream when used with a single append

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3726
2019-08-26 10:49:10 -04:00
Sebastian Holtermann
3b2b02825d Source sweep: Replace std::ostringstream when used with a single append
This replaces `std::ostringstream`, when it is written to only once.
If the single written argument was numeric, `std::to_string` is used instead.
Otherwise, the single written argument is used directly instead of the
`std::ostringstream::str()` invocation.
2019-08-23 18:52:33 +02:00
Sebastian Holtermann
aaf59120bf Source sweep: Replace cmExpandList with the shorter cmExpandedList
This replaces the code pattern
```
std::vector<std::string> args;
cmExpandList(valueStr, args, ...)
```
with
```
std::vector<std::string> args = cmExpandedList(valueStr, ...)
```
2019-08-23 17:07:49 +02:00
Sebastian Holtermann
9b334397f5 Source sweep: Use cmStrCat for string concatenation
This patch is generated by a python script that uses regular expressions to
search for string concatenation patterns of the kind

```
std::string str = <ARG0>;
str += <ARG1>;
str += <ARG2>;
...
```

and replaces them with a single `cmStrCat` call

```
std::string str = cmStrCat(<ARG0>, <ARG1>, <ARG2>, ...);
```

If any `<ARGX>` is itself a concatenated string of the kind

```
a + b + c + ...;
```

then `<ARGX>` is split into multiple arguments for the `cmStrCat` call.

If there's a sequence of literals in the `<ARGX>`, then all literals in the
sequence are concatenated and merged into a single literal argument for
the `cmStrCat` call.

Single character strings are converted to single char arguments for
the `cmStrCat` call.

`std::to_string(...)` wrappings are removed from `cmStrCat` arguments,
because it supports numeric types as well as string types.

`arg.substr(x)` arguments to `cmStrCat` are replaced with
`cm::string_view(arg).substr(x)`
2019-08-22 16:38:10 +02:00
Brad King
ea4c3976fb Merge topic 'install-fail-reason'
891e670e59 install: print reason of failure

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !3696
2019-08-21 11:55:58 -04:00
Jon Chronopoulos
891e670e59 install: print reason of failure
Fixes: #19430
2019-08-17 12:47:19 +10:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Brad King
1996e01578 Merge topic 'cmFileCommand-refactoring'
a7a5f376bc cmFileCommand: Use cmSubcommandTable
b66b7464ab Introduce cmSubcommandTable
2b785875fb cmFileCommand: turn into free function
9703c65718 cmFileCommand: put subcommands in unnamed namespace
64f987c174 cmFileCommand: port to cmExecutionStatus

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3657
2019-08-09 10:39:36 -04:00
Daniel Pfeifer
64f987c174 cmFileCommand: port to cmExecutionStatus 2019-08-06 11:42:25 +02:00
Sebastian Holtermann
18b0330b86 clang-tidy: Enable performance-inefficient-string-concatenation
Enables the clang-tidy test performance-inefficient-string-concatenation
and replaces all inefficient string concatenations with `cmStrCat`.

Closes: #19555
2019-08-05 17:21:00 +02:00
Daniel Pfeifer
1eebc29563 cmCommand: deprecate functions GetMakefile and SetError
Replace the members for the Makefile and the Error with a
cmExecutionStatus.  Re-implement GetMakefile and SetError based on that.

Both functions should be called directly on the cmExecutionStatus that is
passed to InitialPass.  This will help us make all Commands immutable and
remove the need for cloning.
2019-07-21 09:25:32 +02:00
Sebastian Holtermann
9c576a88d9 Use cmFileTimes instead of cmSystemToolsFileTime interface 2019-05-22 10:57:10 +02:00
Kyle Edwards
e3ff7ced63 file(INSTALL): Add FOLLOW_SYMLINK_CHAIN argument 2019-05-16 15:25:33 -04:00
Sebastian Holtermann
98d4846953 Rename cmFileTimeCache::FileTimesDiffer to cmFileTimeCache::DifferS 2019-03-18 15:09:11 +01:00
Bryon Bean
e2e8f6b132 cmFileCommand: Factor out cmFileCopier and cmFileInstaller
Split these classes out into their own sources.
2019-03-13 14:06:32 -04:00