1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-17 01:12:07 +08:00

188 Commits

Author SHA1 Message Date
Brad King
023720e10a cpack: Simplify config file selection 2024-02-27 14:51:48 -05:00
Brad King
cc3c603061 cpack: Simplify package directory selection logic 2024-02-27 14:51:47 -05:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Marc Chevrier
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Martin Duffy
19305afd8a presets: Improve JSON parser and error messages 2023-03-29 10:41:19 -04:00
Brad King
a429e4b9b1 CYGWIN: Drop pre-2.8.4 compatibility mode CMAKE_LEGACY_CYGWIN_WIN32
Prior to CMake 2.8.4 (released in 2011), we defined `WIN32` on CYGWIN.
That was removed, but an undocumented `CMAKE_LEGACY_CYGWIN_WIN32`
compatibility mode was left to help projects transition.  Only projects
that do not require at least 2.8.4 as their minimum CMake version need
the compatibility mode.  We've also long warned about projects that do
not require at least 2.8.12, so it is now reasonable to remove the
legacy compatibility mode.
2023-01-19 14:29:35 -05:00
Alex Turbov
df2047c2ac cpack.cxx: Optimize calls to std::osteam::operator<< 2022-11-17 16:37:13 +04:00
Alex Turbov
f6180485bb cpack.cxx: Eliminate redundant if 2022-11-17 16:37:12 +04:00
Alex Turbov
d7c183f35c cpack.cxx: Deduplicate "Generators" section creation code 2022-11-17 16:37:12 +04:00
Alex Turbov
69918b07e1 cmDocumentationEntry: Drop all user provided ctors for C++ >= 14
There is no need for them cuz:

- the last field has a default value
- all static instances use 2 arguments convertible to `std::string`
- "dynamic" instances used for _Generator_ doc entries access
  fields diectly using default constructed instance

Moreover, compiler may generate move ctor/assign when needed.
2022-11-17 16:37:12 +04:00
Alex Turbov
74b735dea8 cmDocumentation: char*[][2]cmDocumentationEntry[N]
Use fixed size arrays of `cmDocumentationEntry` items instead of
open arrays of two `char` pointers when describe program options
help screens.

Also, drop `const char*[][2]` overloads of methods of
`cmDocumentation` and `cmDocumentationSection` classes in the sake
of generic (template) appenders introduced earlier.
2022-11-17 16:37:11 +04:00
Brad King
12ca3c14a5 Merge topic 'cpack-trace-argument'
b5ebaa0d9c CPack: Require no argument for --trace and --trace-expand

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7824
2022-10-27 09:29:13 -04:00
Kyle Edwards
b5ebaa0d9c CPack: Require no argument for --trace and --trace-expand
This was accidentally broken by commit 87c762d435 (CPack: Use
cmCommandLineArgument instead of cmsys::CommandLineArguments,
2022-04-18, v3.24.0-rc1~258^2).

Fixes: #24085
2022-10-25 10:11:20 -04:00
Kyle Edwards
a8d73085f4 CPack: Add support for presets
Fixes: #23117
2022-08-31 11:56:21 -04:00
Alex Turbov
28ecfd1690 Help: Short options first, then long, then Windows style 2022-08-14 09:58:41 +04:00
FeRD (Frank Dana)
98a10290a8 cmSystemTools: Fix 'ErrorOccurred' spelling
Rename the booleans 's_ErrorOccured' and 's_FatalErrorOccured' to
's_ErrorOccurred' and 's_FatalErrorOccurred', respectively.

Rename the getters and setters to 'Get[Fatal]ErrorOccurred' and
'Set[Fatal]ErrorOccurred', and fix all uses across the codebase.
2022-06-13 09:05:24 -04:00
Kyle Edwards
87c762d435 CPack: Use cmCommandLineArgument instead of cmsys::CommandLineArguments 2022-04-20 11:45:28 -04:00
Rose
b86b6aaa4a Source: Cleanup and simplify some code 2021-11-04 09:20:48 -04:00
Marc Chevrier
cc56dc7468 Rename cmProp in cmValue 2021-09-21 17:14:04 +02:00
Brad King
4281cd15db clang-tidy: fix bugprone-redundant-branch-condition 2021-05-11 15:08:08 -04:00
Brad King
9493532f80 Merge topic 'cmake-E-cat-binary'
f7a5f28318 cmake: Fix '-E cat' command for binary files on Windows
90b39a5209 cmConsoleBuf: Factor out cout/cerr console buffer management
f1fdd15863 clang-format: Fix include block order in ctest.cxx and cpack.cxx

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5364
2020-10-15 08:10:51 -04:00
Brad King
90b39a5209 cmConsoleBuf: Factor out cout/cerr console buffer management 2020-10-14 12:08:06 -04:00
Brad King
f1fdd15863 clang-format: Fix include block order in ctest.cxx and cpack.cxx 2020-10-14 12:06:50 -04:00
Vitaly Stakhovsky
11425041f0 cmMakefile::GetDefinition: return cmProp 2020-09-02 07:27:32 -04:00
Brad King
85a945a607 Restore handling of build directory inside a symlinked path
In commit dd8365b3f1 (Merge branch 'upstream-KWSys' into update-kwsys,
2020-04-06, v3.18.0-rc1~397^2) we imported KWSys commit `019afb6ea`
(SystemTools: Drop GetCurrentWorkingDirectory 'collapse' argument,
2020-04-03).  That caused `GetCurrentWorkingDirectory` to no longer send
paths through the KWSys translation map and broke CMake's detection of
the absolute path to a build directory containing a symbolic link.
Add our own `cmSystemTools::GetCurrentWorkingDirectory` wrapper around
the KWSys method in order to restore that mapping.

Test-case-by: Ben Boeckel <ben.boeckel@kitware.com>
Issue: #16228
Fixes: #20900
2020-07-02 07:33:16 -04:00
Rolf Eike Beer
ef778d77e0 replace std::string::substr() with operations that do not allocate memory
Modify the original string instead of creating a new copy with substr() when it
is not used for anything else afterwards.
2020-03-23 22:41:44 +01:00
Brad King
a4c19cb895 Windows: Restore suppression of error report popups in CI builds
On Windows, libuv uses `_CrtSetReportHook` to install a handler it uses
to suppress assertions on invalid file descriptors in `_get_osfhandle`.
This removes the handler we install in CI environments to suppress
interactive popups.  Move installation of our handler to after libuv is
initialized so that our handler is actually used.

Unfortunately this also removes libuv's handler and so may cause Debug
builds under CI to abort on invalid file descriptors instead of simply
converting them to `INVALID_HANDLE_VALUE`.  If this becomes a problem
we may need to modify libuv to make its hook more configurable.
2019-11-15 09:23:47 -05:00
Johnny Jazeix
63c0bc9292 CPack: Ensure CPACK_PACKAGE_DIRECTORY is an absolute path
Fixes: #18133, #19412
2019-11-01 10:18:33 -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
Tushar Maheshwari
c9c1eb99fe cmCPackGeneratorFactory: rule of zero 2019-09-17 13:05:26 -04:00
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -04:00
Regina Pfeifer
a1ddf2d0ba clang-tidy: Replace typedef with using
Automate the conversion with

  perl -i -0pe 's/typedef ([^;]*) ([^ ]+);/using $2 = $1;/g'

then manually fix a few places.
2019-09-04 18:03:01 +02:00
Regina Pfeifer
62e5f72289 clang-tidy: Replace typedef with using 2019-09-03 13:21:26 -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
c1787cb5eb cpack.cxx: Re-order include blocks to follow our conventions 2019-08-20 09:36:45 -04: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
e91bfe440c cmMakefile: Let AddDefinition accept a value as cm::string_view
This changes `cmMakefile::AddDefinition` to take a `cm::string_view` as value
argument instead of a `const char *`.

Benefits are:
- `std::string` can be passed to `cmMakefile::AddDefinition` directly without
  the `c_str()` plus string length recomputation fallback.
- Lengths of literals passed to `cmMakefile::AddDefinition` can be computed at
  compile time.

In various sources uses of `cmMakefile::AddDefinition` are adapted to avoid
`std::string::c_str` calls and the `std::string` is passed directly.
Uses of `cmMakefile::AddDefinition`, where a `nullptr` `const char*` might
be passed to `cmMakefile::AddDefinition` are extended with `nullptr` checks.
2019-07-24 11:11:25 +02:00
Craig Scott
a2319c04f6 Merge topic 'cleanup-statics-stream-flush'
af75ab7645 Refactor: Use anonymous namespace instead of `static`s in `cpack.cxx`
0db458a0ce Refactor: Use anonymous namespace instead of `static`s
0328b64efd Refactor: Remove one-time used macros
b821f9ad62 Refactor: Optimize some stream output operations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3535
2019-07-12 20:26:12 -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
Alex Turbov
af75ab7645 Refactor: Use anonymous namespace instead of statics in cpack.cxx
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2019-07-10 01:07:18 +03:00
Brad King
c85524a94a Ensure stdin, stdout, and stderr pipes are always open
On non-Windows platforms libuv assumes that file descriptors 0-2 are
always used for standard pipes and never for anything else.  Otherwise,
libuv may re-use one of these descriptors and then fail an assertion
when closing it.  Similarly, On Windows platforms our ConsoleBuf
implementation assumes that the standard handles are always open.

If CMake is run with any standard pipes closed, open them with
`/dev/null` or `NUL` to satisfy these assumptions.

Fixes: #19219
2019-05-02 14:34:58 -04:00
Artur Ryt
2d66567dca Modernize: Prefer .substr in place of .c_str() + int
A lot of temporary/local strings were created out of C-strings
substr can utilize current string size, so in theory be a little
more efficient.
2019-03-30 16:15:05 +01:00
Vitaly Stakhovsky
950c099d83 cmake: Progress functions use std::string param 2019-02-11 10:32:43 -05:00
Regina Pfeifer
bcee24aecc Use std::function for callbacks 2019-01-29 16:32:52 +01:00
Vitaly Stakhovsky
25caf7bafe cmMakefile::ReadListFile() accepts std::string argument
Same for cmMakefile::ReadDependentFile(); some cleanup
2019-01-17 12:36:07 -05:00
Kyle Edwards
4568d046c4 Properties: Add CMAKE_ROLE global property
This property allows scripts to determine whether they're in project
mode, script mode, find-package mode, CTest, or CPack.
2019-01-17 09:44:29 -05:00
Brad King
d99e1cca20 Merge topic 'cpack-status-callback'
4a3ae1710e CPack/External: Fix status messages of staging scripts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2696
2018-12-10 08:17:06 -05:00
Nils Gladitz
4a3ae1710e CPack/External: Fix status messages of staging scripts
Set progress callback on cmake instance used by CPack.  The progress
callback is used to output STATUS messages which are otherwise missing
when issued from e.g. CPack External staging scripts.

Fixes: #18567
2018-12-07 07:33:30 -05:00