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

247 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
8ef18e8525 Clean a few string conversions 2020-07-09 09:42:00 -04:00
Asit Dhal
b5b6075522 cmake: add dedicated error for -E compare_files invalid arguments
Return 2 when user provides invalid arguments

Fixes: #20815
2020-06-15 12:39:37 -04:00
Asit Dhal
a7d44d55ae cmake: remove -E compare_files error message if files differ
It is not an error for the files to be different.

Fixes: #20803
2020-06-10 07:23:10 -04:00
Marc Chevrier
2faa3f6c55 Refactoring: Third-parties public headers are under cm3p prefix
Fixes: #20666
2020-05-07 12:06:08 +02:00
Brad King
d9eb9e785e Merge topic 'win-user-manifest-rc'
7ca13e04fa Windows: Merge user-provided manifests into compiled resource

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4484
2020-04-22 09:15:59 -04:00
Kenney Phillis
7ca13e04fa Windows: Merge user-provided manifests into compiled resource
Previously we merged user-provided manifests only into the manifest file
given to the linker.  Merge them into the manifest file that is compiled
as a resource too.
2020-04-21 08:10:45 -04:00
Marc Chevrier
aacd4e4a90 Refactoring: add cm::contains to <cmext/algorithm> 2020-04-17 10:00:03 +02:00
Kyle Edwards
5f20e85412 Merge topic 'cat_cmd_20557'
a625f30785 cmake -E: add cat command.

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4600
2020-04-16 11:35:55 -04:00
Johnny Jazeix
a625f30785 cmake -E: add cat command.
Concatenate files and print on the standard output.

FIXES: #20557
2020-04-15 20:56:56 +02:00
Ben Boeckel
f2a33107be clang-tidy: address bugprone-branch-clone lints
Arguably, many of these are bugs in `clang-tidy`. An if/else tree with
other conditionals between cloned blocks may be relying on the
intermediate logic to fall out of the case and inverting this logic may
be non-trivial.

See: https://bugs.llvm.org/show_bug.cgi?id=44165
2020-04-13 11:26:02 -04:00
Brad King
c0438d272d Merge topic 'llvm-rc-include-path'
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4570
2020-04-07 08:00:45 -04:00
Thomas Bernard
35a29ec827 llvm-rc: Restore include path for data after explicit preprocessing
Since commit 1c2d031cbd (Add -E cmake_llvm_rc to preprocess files for
llvm-rc, 2020-01-14, v3.17.0-rc1~24^2) with llvm-rc we explicitly
preprocess RC source files and then compile separately without -I flags.
This broke cases where the RC source references data files adjacent to
itself or in the include path.

This change adds the expansion of the include paths when calling the
llvm-rc in order for the resource files to be picked up correctly by
llvm-rc.  Since the RC compiled file is first preprocessed, the file
being compiled by llvm-rc resides in the build directory. In order for
llvm-rc to find the resource data specified relative to the .rc file
being compiled, the source file path is preppended in the include list
so that the original source path takes priority over all the other
includes paths specified.

A space was added in the CMAKE_INCLUDE_FLAG_RC to make the include
directive work properly for llvm-rc. Checks on the rc.exe showed that
the syntax change doesn't affect it's proper operation.

Fixes: #20529
2020-04-06 21:19:12 +02:00
Brad King
a88b27bfc7 Merge topic 'llvm-rc-stderr'
dc93cbb0d8 llvm-rc: Print stderr output when calling tools through cmake_llvm_rc

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4525
2020-03-27 07:39:30 -04:00
Brad King
4b266927c7 Merge topic 'cleanup-endls-3'
8e3a65d963 Refactor: Avoid `std::endl` where it's not necessary (part 3)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4517
2020-03-26 09:19:31 -04:00
Thomas Bernard
dc93cbb0d8 llvm-rc: Print stderr output when calling tools through cmake_llvm_rc
The stored error pipe is output if the program fails.

Fixes: #20494
2020-03-26 07:59:55 -04:00
Alex Turbov
8e3a65d963
Refactor: Avoid std::endl where it's not necessary (part 3)
The `std::endl` manipulator, except inserting `\n` character, also
performs `os.flush()`, which may lead to undesired effects (like
disk I/O in the middle of forming data strings). For the
`std::stringstream` it also has no meaning.

* replace multiple `operator<<` calls on a string literal w/
  the only call and the only (bigger) string literal;
* replace one character string literal used in `operator<<`
  w/ a char literal.
2020-03-24 21:33:33 +08:00
Rolf Eike Beer
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix() 2020-03-23 22:41:43 +01:00
Rolf Eike Beer
bfb69f9543 replace "substr(0, xx) ==" with cmHasPrefix() 2020-03-23 20:19:26 +01:00
Thomas Bernard
1c2d031cbd Add -E cmake_llvm_rc to preprocess files for llvm-rc
llvm-rc requires preprocessed rc files. The CMake command line tool
cmake_llvm_rc enables channing the preprocessor call and the resource
compiler and make this appear as single compilation step.

When llvm-rc is detected as resource compiler, the RC compilation step
is set to use this command.
2020-02-04 08:19:12 -05:00
Marc Chevrier
a00960288b GlobalGenerator family: modernize memory management 2020-01-07 11:03:11 +01:00
Marc Chevrier
f7d12609f0 Refactoring: use append functions from cmext/algorithm 2019-12-17 10:44:02 +01:00
Marc Chevrier
36c8cae2e8 cmLocalGenerator: modernize memory management 2019-12-10 00:24:06 +01:00
Isuru Fernando
5ff1d7bd90 Add support for WINDOWS_EXPORT_ALL_SYMBOLS when cross-compiling to Windows
Implement `__create_def` using `llvm-nm` (when given as `CMAKE_NM`).
2019-12-06 09:30:25 -05:00
Johnny Jazeix
5239fc5c75 cmake -E: Add rm with improved semantics over remove and remove_directory 2019-11-13 18:02:18 -05: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
Sebastian Holtermann
6bd40ccf84 Autogen: Make cmQtAutoMocUic a free function 2019-09-29 00:07:32 +02:00
Sebastian Holtermann
e0e9be3d57 Autogen: Make cmQtAutoRcc a free function 2019-09-29 00:07:32 +02:00
Sebastian Holtermann
820962edc9 Autogen: Refactor json info file reading interface 2019-09-29 00:07:32 +02:00
Sebastian Holtermann
881e3cfbf9 Autogen: Variable renames and cleanups 2019-09-25 10:31:06 +02:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Regina Pfeifer
d25a5a7ec9 clang-tidy: modernize-use-auto
Set the MinTypeNameLength option to an impossibly high value in order
to limit the diagnostics to iterators.  Leave new expressions and cast
expressions for later.
2019-09-10 22:21:41 +02:00
Daniel Eiband
ff5028c531 Windows: Prevent auto exports to be regenerated on every build
Check modified time stamps of input files against an existing exports file
before generating the auto exports.

Fixes: #19650
2019-09-09 15:43:15 +02:00
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -04:00
Brad King
4684e64c84 Merge topic 'clang-ipo-support'
dca9c33abc Tests: Remove old IPO test
c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm
079b8e2916 Clang: prefer lld-link over link.exe
6e3655db2c Clang: add LTO support for GNU-command line clang on windows

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3527
2019-09-03 09:39:03 -04:00
Zsolt Parragi
c856d4556b bindexplib: supporting llvm bitcode formats using llvm-nm 2019-08-30 11:30:38 -04:00
Brad King
a38965db9a Merge topic 'remove_directory-symlink'
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3738
2019-08-30 10:38:25 -04:00
Jon Chronopoulos
e6c9a8bac3 cmake: Teach -E remove_directory to remove directory symlinks
If the argument to `remove_directory` is a symlink to a directory,
remove the symlink instead.

Issue: #19533
2019-08-30 10:37:30 -04: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
337be1507d Merge topic 'isolate-declarations'
d331021255 clang-tidy: isolate declarations for readability

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3704
2019-08-22 10:23:34 -04:00
Brad King
bfe0ea2d98 Merge topic 'cm-contains'
2dfc52675c cmAlgorithms: Add cmContains

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Sebastian Holtermann <sebholt@web.de>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !3700
2019-08-21 11:52:06 -04:00
Regina Pfeifer
d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Regina Pfeifer
2dfc52675c cmAlgorithms: Add cmContains
Also, use the new function where applicable.
2019-08-19 20:01:39 +02:00
Sebastian Holtermann
20e580be01 Source sweep: Use cmIsOn instead of cmSystemTools::IsOn
This replaces invocations of

- `cmSystemTools::IsInternallyOn` with `cmIsInternallyOn`
- `cmSystemTools::IsNOTFOUND` with `cmIsNOTFOUND`
- `cmSystemTools::IsOn` with `cmIsOn`
- `cmSystemTools::IsOff` with `cmIsOff`
2019-08-17 12:14:14 +02:00
Sebastian Holtermann
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument 2019-08-14 16:33:20 +02:00
Kitware Robot
54e9d38c28 Refactor: Convert all instances of CMAKE_BUILD_WITH_CMAKE to CMAKE_BOOTSTRAP 2019-08-09 10:41:44 -04:00
Sebastian Holtermann
f71f7ce3f0 cmStringAlgorithms: Move string functions to the new cmStringAlgorithms.h
This adds the `cmStringAlgorithms.h` header and moves all string functions
from `cmAlgorithms.h` to `cmStringAlgorithms.h`.
2019-07-29 21:13:56 +02:00
Kyle Edwards
b8828ecbba cmake -E: Add true and false commands 2019-07-11 13:41:30 -04:00
Brad King
71fbebd1dc IWYU: Fix handling of <memory> standard header
An old workaround for `std::allocator_traits<>::value_type` lints from
IWYU on `std::vector<>` usage breaks IWYU's handling of `<memory>`.
Convert the workaround to use the same approach we already use for a
workaround of `std::__decay_and_strip<>::::__type` lints.  Then update
the `<memory>` inclusions to follow the now-correct IWYU lints.
2019-07-10 11:48:56 -04:00
Brad King
6696855f72 cmake: Simplify implementation of -E capabilities
The `cmake -E capabilities` command-line tool is implemented only in a
full-featured (non-bootstrap) CMake, and server mode is now always
available in this case.
2019-06-07 11:08:38 -04:00