1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-21 20:11:22 +08:00

142 Commits

Author SHA1 Message Date
Vitaly Stakhovsky
b3edfcf46e cmValue: Use operator* explicitly to convert to std::string; avoid extra call 2023-01-15 23:39:02 -05:00
Ben Boeckel
6ff03d463f clang-tidy: address google-readability-casting lints
At least those involving `static_cast`.
2022-05-24 09:09:43 -04:00
Rose
b86b6aaa4a Source: Cleanup and simplify some code 2021-11-04 09:20:48 -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
Marc Chevrier
7fce78982b Use new SetOption signatures 2021-09-15 18:30:49 +02:00
Marc Chevrier
202a65759b cmCPackGenerator::GetOption returns cmProp 2021-09-13 09:54:27 -04:00
Brad King
20fec15204 cmArchiveWrite: Check for construction errors on Open
Also update call sites to report the error.

Issue: #19666
2021-08-20 11:23:20 -04:00
Russell Greene
051da997da CPack/DEB: Add zstd compression for deb packages 2021-07-29 13:40:40 -04:00
Alex Turbov
9dc007e17c
Refactor: Drop redundand std::endl calls in the middle of output 2021-07-13 16:42:04 +03:00
Alex Turbov
afcc5449e8 Refactor: Use cmStrToLong instead of std::strtol 2021-07-13 08:56:39 -04:00
Alex Turbov
13549674cc Refactor: Avoid duplicate calls to GetOption("GEN_DBGSYMDIR") 2021-07-13 08:36:12 -04:00
Alex Turbov
7add10f288 Refactor: Deduplicate code of createDebPackages()
Also, fix incorrect `retval` accumulation.
2021-07-13 08:36:12 -04:00
Alex Turbov
593ff734b0 CPack/DEB: dbgsym package not generated for non-component packaging
Fix: #19735
2021-07-13 08:36:12 -04:00
Alex Turbov
c8f298ae08 Refactor: Extract packaged files finder into a function 2021-07-13 08:36:12 -04:00
Alex Turbov
7fd3134ea1 Refactor: cmCPackDebGenerator::PackageComponents handle else first
Also, return early to reduce nesting level of the function body.
2021-07-13 08:35:27 -04:00
Alex Turbov
008321595a Refactor: Change return value to bool for private members
The `cmCPackDebGenerator::createDeb()` and `cmCPackDebGenerator::createDbgsymDDeb()`
in fact have boolean return value.
2021-07-13 08:35:27 -04:00
Alex Turbov
45a6fa0c33 Refactor: Drop unnecessary if before return 2021-07-13 08:35:27 -04:00
Alex Turbov
700abe7bca Refactor: Drop useless assignments of retval before return 2021-07-13 08:35:27 -04:00
Alexey Rogachevskiy
9028195a22 CPackDeb: sort package files before generating deb file
This should make the order in which the files are added to md5sums
and archives is stable, thus making package files more reproducible.

Fixes: #22361
2021-06-30 08:47:59 -04:00
Brad King
f881b4e4cc cmCPackDebGenerator: Remove unused local variable 2021-04-28 10:09:52 -04:00
Nils Gladitz
c5c130e675 cmArchiveWrite: Consolidate multiple ways to set thread count
Merge use of SetFilterOption() into more abstract thread count
in cmArchiveWrite constructor.

libarchive defaulting of threads for threads == 0 seems to be
configuration dependent. Preemptively default thread count via
std:🧵:hardware_concurrency().

Also allow negative values for the thread count in which case
the detected hardware concurrency is also used but the given
absolute thread count is used as an upper limit.
2021-04-22 15:40:13 -04:00
Rodolfo Lima
bdf30bdad8 CPack: add CPACK_THREADS variable to control compression threads
This allows setting how many threads the compressor will use.
Currently only implemented for XZ when using system's lzma library.

Fixes: #21715
2021-01-26 16:23:37 +01:00
Asit Dhal
8f33674491 cpack(DEB): Issue warning if custom script for control file is missing
Fixes: #17794
2021-01-15 16:41:37 +01:00
Oleksandr Koval
209daa20b2 Code style: add missed explicit 'this->'
CMake uses explicit 'this->' style. Using custom clang-tidy check we can
detect and fix places where 'this->' was missed.
2021-01-05 14:32:36 +02:00
Andrew Fuller
c826745f5a CPack/DEB: Do not crash when asked for debug symbols when there are none
Fixes: #21356
2020-11-16 14:03:07 -05:00
Vitaly Stakhovsky
f37c14e930 Source: use cmNonempty() 2020-07-28 08:31:31 -04:00
Kyle Edwards
3ffd2741c1 CPack: Fix newline output in .deb generator
When running CPack on Windows, LF newlines are converted to CRLF
unless binary mode is used. Use binary mode whenever possible.

Fixes: #20659
2020-04-30 10:58:22 -04:00
Brad King
fb5d24fa3c Merge topic 'cpack-symlinks'
bcc5cd44ed CPack: Do not recurse through directory symlinks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4637
2020-04-22 08:30:53 -04:00
Brad King
bcc5cd44ed CPack: Do not recurse through directory symlinks
Extend the fix from commit 7b8dcdd173 (CPack: Do not recurse through
directory symlinks (#12284), 2011-08-27, v2.8.6~55^2) to more places in
CPack.

Issue: #12284
2020-04-21 07:28:06 -04:00
Ben Boeckel
b9c17de023 cmArchiveWrite: split out opening the file
This allows options to be set before the "header" phase of libarchive's
API.
2020-03-31 11:08:32 -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
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
Regina Pfeifer
f30523d090 clang-tidy: modernize-deprecated-headers 2019-09-16 10:11:13 -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
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
Brad King
a13a5c948e Replace use of CollapseCombinedPath with CollapseFullPath
`CollapseCombinedPath` was introduced by commit 551d3343cd (cmDependsC:
Collapse relative include paths, 2013-06-19, v2.8.12~237^2) where the
existing `CollapseFullPath` should have been used instead.  Then its use
proliferated slightly.  Since `CollapseCombinedPath` is less widely used
and less robust (see issue #19049), use `CollapseFullPath` everywhere
instead.

Issue: #19050
2019-03-19 09:57:23 -04:00
Regina Pfeifer
55671b41d2 clang-tidy: Use = default
Suppress some cases in `Source/cmGeneratorExpressionNode.cxx` and
`Source/cmUVHandlePtr.h` where a few older compilers require a
user-defined default constructor (with `{}`).
2019-01-25 06:44:32 -05:00
Regina Pfeifer
5a0784ddea clang-tidy: Pass by value 2019-01-22 13:03:04 -05:00
Guillem Jover
38e75bb3c6 CPack/Deb: Remove paxr as a supported tar format for a .deb
The only format supported from the ones available within cpack is
gnutar, which supports large numbers encoded in base-256, and long
filenames and linknames. PAX is not and has never been a supported
format by dpkg.

Fixes: #18620
2018-11-28 09:31:28 -05:00
Andrew Fuller
d8a3939aef CPack/Deb: Add ability to split out debug symbols into .ddeb package 2018-09-21 20:19:31 +00:00
Sebastian Holtermann
b6802cd506 cmGeneratedFileStream: clang-tidy applied to remove redundant `c_str` calls
After changing the ``cmGeneratedFileStream`` methods to accept
``std::string const&`` instead of ``const char*`` we don't
need to call ``std::string::c_str`` anymore when passing
a ``std::string`` to a ``cmGeneratedFileStream`` method.

This patch removes all redundant ``std::string::c_str``
calls when passing a string to a ``cmGeneratedFileStream`` method.

It was generated by building CMake with clang-tidy enabled using
the following options:

-DCMAKE_CXX_CLANG_TIDY=/usr/bin/clang-tidy-4.0;-checks=-*,readability-redundant-string-cstr;-fix;-fix-errors
2018-08-07 17:02:39 +02:00
Brad King
83db42fa99 Merge topic 'cpack-fix-deb-packaging'
2774259100 CPack/Deb: Restore setting of root as the owner of files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2178
2018-07-03 10:48:03 -04:00
Andrew Fuller
2774259100 CPack/Deb: Restore setting of root as the owner of files
Refactoring in commit v3.10.0-rc1~220^2 (cmCPackDebGenerator: Use
libarchive to create .deb file) accidentally broke this for the
top-level archive.
2018-07-02 13:17:43 -04:00
Kyle Edwards
48bc8b2b82 CPack: Move internal implementation modules into Internal/CPack directory
These modules are not meant to be included by user code, they are
only an internal implementation detail for CPack. Having them live
in the main Modules directory with documentation was misleading, so
they have been moved into Modules/Internal/CPack, and their
documentation has been stripped following its move into the new
"CPack Generators" section. No-op modules which contained only
documentation have been removed entirely.

The only module that hasn't been moved is CPackIFW, because it
contains user-facing macros which would be lost if it were moved.
So, the CPackIFW module has been updated with a note explaining what
needs to (eventually) happen.
2018-06-21 11:00:28 -04:00
Kitware Robot
d7204e649e Revise C++ coding style using clang-format-6.0
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 6.0.

* 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.
2018-06-01 09:53:42 -04:00
Pavel Solodovnikov
c85bb007df Reduce allocation of temporary values on heap.
- Use `std::move` while inserting temporary results into vectors.
- Change `push_back` to `emplace_back` where appropriate.
2018-01-26 13:24:45 +03:00