Commit Graph

794 Commits

Author SHA1 Message Date
Kyle Edwards ad19da011d Refactor: Add cmSystemTools::GetSystemName()
And use it for CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME.
2021-03-15 14:41:42 -04:00
Ben Boeckel 100016e9cb cmSystemTools: add utilities to copy a file with error handling 2021-03-09 09:47:26 -05:00
Brad King 3600c6cd8c cmSystemTools: Add RenameFile option to not replace destination 2021-03-04 08:47:31 -05:00
Brad King 0c2dc34504 cmSystemTools: Add RenameFile signature to capture the error message 2021-03-04 08:26:21 -05:00
Brad King e017ba046c AIX: Enable XCOFF editing to replace RPATH on installation
Avoid relinking before installation.
2021-02-03 12:26:58 -05:00
Brad King cdcfe3eb99 Rename CMAKE_USE_MACH_PARSER to CMake_USE_MACH_PARSER
We use the `CMake_` prefix for options affecting CMake itself.
2021-02-03 11:35:31 -05:00
Brad King b6071c93f5 Rename CMAKE_USE_ELF_PARSER to CMake_USE_ELF_PARSER
We use the `CMake_` prefix for options affecting CMake itself.
2021-02-03 11:35:31 -05:00
Ben Boeckel c826461d9c clang-tidy: fix bugprone-reserved-identifier warnings 2021-01-27 08:45:44 -05:00
Marc Chevrier 8ec7408d74 Makefile dependencies: ensure long paths are used on Windows 2021-01-09 11:35:00 +01:00
Brad King 92021198e5 cmSystemTools: Revert use of MOVEFILE_WRITE_THROUGH by RenameFile on Windows
Revert commit d78c22aa64 (cmSystemTools: Improve RenameFile on Windows
with MOVEFILE_WRITE_THROUGH, 2020-08-25, v3.19.0-rc1~243^2~3).  Using
this flag causes the operation to fail frequently in some environments.
Drop it for now pending further investigation.

Fixes: #21571
2020-12-17 08:35:38 -05:00
Kyle Edwards 0fe2ee3d43 CMake GUI: Add "CMake Reference Manual" help item
And switch the ordering of "Help" and "About".
2020-09-30 16:17:31 -04:00
Kyle Edwards 391ff1ec51 Refactor: Modernize cmSystemTools::FindCMakeResources()
Use cmStrCat(), cmStrLen(), and cmHasLiteralSuffix().
2020-09-30 16:13:10 -04:00
Elad Lahav f9e950d4c5 libuv: Add support for building for QNX within CMake 2020-09-25 11:53:44 -04:00
Asit Dhal 195d14e781 file(ARCHIVE_CREATE): Add option to control compression level
Fixes: #21125
2020-09-21 13:08:11 -04:00
Ron W Moore e39e9c4043 cmSystemTools: Teach RenameFile to disable Windows Search Indexing
Create RAII class SaveRestoreFileAttributes to manage Windows Search
Indexing.  Turn it off temporarily while renaming a directory.

Issue: #19580
2020-08-31 13:03:36 -04:00
Ron W Moore b54190a406 cmSystemTools: Teach RenameFile to try for longer on directories
Issue: #19580
2020-08-31 13:03:36 -04:00
Ron W Moore 2f8ef095da cmSystemTools: Add more error handling to RenameFile on Windows
Issue: #19580
2020-08-31 13:03:36 -04:00
Ron W Moore d78c22aa64 cmSystemTools: Improve RenameFile on Windows with MOVEFILE_WRITE_THROUGH
Add this flag to tell `MoveFileExW` to flush the rename to disk before
returning.

Issue: #19580
2020-08-31 13:03:36 -04:00
Ron W Moore 73f8240ae7 cmSystemTools: Factor out RenameFile wstring conversion on Windows 2020-08-31 13:03:36 -04:00
Brad King 97fc44f70e cmSystemTools: Factor out MoveFileExW call in RenameFile 2020-08-31 13:03:11 -04:00
Brad King 35039286eb cmSystemTools: Define directory-specific Windows filesystem retry settings
Inspired-by: Ron W Moore <webbtrail@gmail.com>
2020-08-27 17:02:03 -04:00
Vitaly Stakhovsky 8ef18e8525 Clean a few string conversions 2020-07-09 09:42:00 -04:00
Brad King 977f5ed3d1 Merge topic 'restore-cwd-translation-map'
85a945a607 Restore handling of build directory inside a symlinked path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4963
2020-07-03 07:25:31 -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
Brad King 0fddcc1e5b cmake: Tolerate nullptr from uv_default_loop
`uv_default_loop()` can return `nullptr` when running on a Linux kernel
configured without `CONFIG_EVENTFD`.

Fixes: #20899
2020-07-01 16:26:44 -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 f0a27e44f3 Merge topic 'parallel-lzma-compression'
b3bacf0152 cmCPackArchiveGenerator: support multithreaded compression
b71d385ed4 cmCPackArchiveGenerator: support setting archive options
948aa8bd1c cmArchiveWrite: support setting archive filter options
b9c17de023 cmArchiveWrite: split out opening the file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Cristian Adam <cristian.adam@gmail.com>
Merge-request: !3195
2020-04-06 08:28:19 -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
Brad King 577fc3ef19 Merge topic 'string-prefix'
ec7928ef26 use _s to construct static string_views at several places
94de927cab VS10Generator: avoid many string allocations
8ca2504a4d use string_views to avoid memory allocations
761f1adcae check for a valid URL scheme before starting to do any splitting
ef778d77e0 replace std::string::substr() with operations that do not allocate memory
77616f4681 pass cm::string_view to cmVisualStudioSlnParser::ParseTag()
ada6a3226f use cm::string_view for language extension lookups
48adc29721 replace "std::string::find(x) == 0" with cmHasPrefix()
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4501
2020-03-26 09:15:41 -04:00
Rolf Eike Beer bfb69f9543 replace "substr(0, xx) ==" with cmHasPrefix() 2020-03-23 20:19:26 +01: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 557cecdc3d Modernize memory management
Update internals of various classes
2020-02-27 11:11:30 +01:00
Marc Chevrier f7d12609f0 Refactoring: use append functions from cmext/algorithm 2019-12-17 10:44:02 +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
Craig Scott 0692eaf0fe ForceToRelativePath: Fix spurious assertion when local path is root dir
Fixes: #19909
2019-11-02 17:54:13 +11: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 1a1508c8b8 Merge topic 'modernize-use-auto'
d25a5a7ec9 clang-tidy: modernize-use-auto

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3783
2019-09-12 09:15:38 -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
Rolf Eike Beer 5eaf1e1be2 cmSystemTools: introduce MoveFileIfDifferent() 2019-09-09 10:30:25 +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
Regina Pfeifer d331021255 clang-tidy: isolate declarations for readability 2019-08-21 00:20:49 +02:00
Sebastian Holtermann 3b6c62be23 cmSystemTools: Remove IsInternallyOn, IsNOTFOUND, IsOn, IsOff
The removes the following methods from cmSystemTools:

- `IsInternallyOn`
- `IsNOTFOUND`
- `IsOn`
- `IsOff`
2019-08-17 12:14:14 +02:00
Kyle Edwards 2beed5a4ef Merge topic 'cmExpandList'
2f6495e24e cmSystemTools: Remove ExpandListArgument methods
f4f3c68926 Source code: Use cmExpandList instead of cmSystemTools::ExpandListArgument
ff42dec891 cmStringAlgorithms: Add cmExpandList functions

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3682
2019-08-16 14:51:03 -04:00
Kyle Edwards dcf2beb7de Merge topic 'cmStringAlgorithms_ulong'
935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3681
2019-08-16 14:49:28 -04:00
Sebastian Holtermann 2f6495e24e cmSystemTools: Remove ExpandListArgument methods 2019-08-14 16:33:20 +02:00
Kyle Edwards fb56ac9209 Merge topic 'retry-directory-delete'
6bc77966ad Retry removing directories on Windows
5729580376 Use registry setting for removal retry count and delay

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3667
2019-08-13 10:07:09 -04:00
Sebastian Holtermann 935fbe0b04 cmStringAlgorithms: Add cmStrToLong and cmStrToULong
This adds the following functions to cmStringAlgorithms:
- `cmStrToLong`: moved from `cmSystemTools::StringToLong`
- `cmStrToULong`: moved from `cmSystemTools::StringToULong`

Overloads of the given functions for `std::string` are added as well.
2019-08-10 14:39:03 +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
Kasper Laudrup 5729580376 Use registry setting for removal retry count and delay
Instead of hardcoding the amount of retries and the time to sleep
between them when removing directories on Windows, use the setting
potentially present in the registry instead. This setting is already
used when retrying moving directories.
2019-08-08 15:59:02 +02:00