1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-06-05 13:56:54 +08:00

499 Commits

Author SHA1 Message Date
Brad King
434fe8a34b file(DOWNLOAD|UPLOAD): Add CMAKE_TLS_VERSION environment variable
Issue: #25701
2024-02-28 08:40:27 -05:00
Brad King
fb9a6cf909 file(DOWNLOAD|UPLOAD): Add CMAKE_TLS_VERSION variable
Issue: #25701
2024-02-28 08:40:27 -05:00
Brad King
8e6776b9f3 file(DOWNLOAD|UPLOAD): Add TLS_VERSION option for https connections
Add an option to specify the minimum allowed TLS version for https
connections.

Issue: #25701
2024-02-28 08:40:14 -05:00
Cristian Le
fa00928bcd file: STRINGS + REGEX store match results
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2024-01-09 16:36:55 -05:00
Brad King
d101cb07ec Merge topic 'cmFileCopier-error-loss'
a820877d03 errors: avoid constructing a stream before getting the last error
5cf7018af6 cmFileCopier: remember error statuses and get their strings
0639a32d3a cmFileTimes: return status codes from APIs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9023
2023-12-05 09:23:49 -05: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
f02c3c6181 cmFileCommand: combine string literals 2023-10-19 23:00:16 -04:00
scivision
f5ff17fcf2 Source: Remove redundant FileIsSymlink checks
Replace `FileExists || FileIsSymlink` with `PathExists`.
The latter does not resolve symlinks, so this is OK for use
with broken symlinks, files, and directories.
2023-09-18 16:35:10 -04:00
Robert Maynard
c85fd9a705 file: Clarify CMake only drops RPATHS's it added 2023-08-15 14:59:14 -04:00
Brad King
c05d06c6ed Merge topic 'file-GENERATE-arg-parsing'
88f90a72f1 file(GENERATE): Restore INPUT|CONTENT parse checking

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8694
2023-08-08 10:06:39 -04:00
Evan Wilde
88f90a72f1 file(GENERATE): Restore INPUT|CONTENT parse checking
Refactoring in commit bff468c988 (cmFileCommand: Use cm::optional for
keyword argument presence, 2022-06-30, v3.25.0-rc1~512^2) accidentally
broke the check that the input argument is either `INPUT` or `CONTENT`.

The check is supposed to fail when arguments are passed in the wrong
order.  For example:

    file(GENERATE OUTPUT ...
         TARGET <target>
         CONTENT <content>)

Prior to this fix, the input method would be CONTENT, but because the
first parsed keyword is not `CONTENT`, `inputIsContent` would be false.
The first parsed keyword isn't INPUT either, so we would not continue
into the error condition. CMake would then try to handle this as an
input file, when there isn't one, resulting in uninitialized memory
usage and segfaults or corruption later on.

Fixes: #25169
2023-08-07 19:17:29 -04:00
Robert Maynard
6b5f2dbbfe
file(REAL_PATH): resolve symlinks before '..' components
Previously REAL_PATH would collapse paths before resolving any symlinks
so if `..` crossed a symlink the output from `REAL_PATH` would be wrong.

It looked like REAL_PATH did this by mistake since it was a side-effect
of ensuring we had an absolute path before resolving symlinks.
2023-07-20 17:02:58 -04:00
Marc Chevrier
45f17e5a85 cmList: Add container conversion to string 2023-06-22 15:44:17 +02:00
Marc Chevrier
1d12853ed3 file(REAL_PATH): Ensure same behavior as get_filename_component(REALPATH)
Fixes: #24605
2023-03-20 14:14:11 +01:00
Brad King
b2fe717a49 file: Avoid using deprecated curl progress callback 2023-01-27 15:57:54 -05:00
Terence Noone
efae1ab68b file(MAKE_DIRECTORY): Provide a more descriptive error message
Previously, MAKE_DIRECTORY would print `problem creating directory: {}`,
which was very unhelpful for debugging.  Extend the message with the
OS error string.
2022-12-08 07:54:55 -05:00
Brad King
efa9eec040 file(COPY_FILE): Add option to retry on Windows if input access fails
On Windows, a file may be inaccessible for a short time after it is
created.  This occurs for various reasons, including indexing, antivirus
tools, and NTFS's asynchronous semantics.  Add an `INPUT_MAY_BE_RECENT`
option to tell CMake that the input file may have been recently created
so that we can retry a few times to read it.
2022-11-17 15:05:07 -05:00
Amir Masoud Abdol
ed519b1cba file(ARCHIVE_CREATE): Allow higher compression level for Zstd
This allows the Zstd compression-level to be set between 0-19.  I've
adjusted some of the tests, and error messages to indicates the selected
algorithm, and min/max of its compression-level.

Fixes: #24160
2022-11-16 09:15:01 -05:00
Kyle Edwards
09d7f947d6 cmGeneratorExpression: Require cmake instance 2022-11-11 12:29:41 -05:00
Aurelien Regat-Barrel
8c3cf2716a
file(DOWNLOAD EXPECTED_HASH): better error message when download failed 2022-11-09 22:44:36 +01:00
Aurelien Regat-Barrel
d78671879b file(DOWNLOAD): Fix LOG with EXPECTED_HASH on download failure
When `file(DOWNLOAD <url> EXPECTED_HASH <hash> LOG <logs>)` fails to
download the requested file, the hash check will also fail and make the
command exit without actually returning the curl logs as requested
by the `LOG` argument.  Report the log before checking the hash.

Issue: #24093
2022-10-30 08:42:19 -04:00
Brad King
aba48bd6ac cmSystemTools: Provide quiet link creation methods
Offer variants that let the caller handle error messages.
2022-10-06 14:38:53 -04:00
Brad King
ef1d34b20d Merge topic 'parse-large-int'
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
31f158e4c8 cmStringAlgorithms: Add functions to parse strings to long long integers

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7698
2022-09-21 10:12:11 -04:00
Brad King
8fc822e13a file: Avoid strange istringstream crash in cmake.org binaries on Alpine Linux
Somehow using `istringstream` and `operator >>` to parse an integer
crashes on Alpine Linux, at least when compiled with the settings we use
for the official `cmake.org` Linux binaries.  Since commit fd0c285b12
(file: Fix types of the OFFSET and LIMIT arguments, 2022-01-04,
v3.23.0-rc1~133^2), this causes the `file(READ)` command to crash when
parsing its `LIMIT` or `OFFSET` argument.  Parse the input string with
our dedicated helper to avoid the crash.

Fixes: #23872
2022-09-20 12:00:08 -04:00
Michael Hirsch
87a40b720a
file(DOWNLOAD): Fix message for existing file with matching hash
file(DOWNLOAD STATUS) docs say the return list is of
length 2. However, when an already downloaded file
hash matches EXPECTED_HASH, the return message had
a semicolon that made the return list length 3.
Adjust the message to no longer contain the extra semicolon
and to more clearly describe the situation.
2022-08-23 22:40:28 +10:00
Brad King
6ecd741b5f cmFileCommand: Capture list of parsed keywords via binding 2022-07-25 13:52:11 -04:00
Brad King
f95a5832c7 cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()
All clients have been converted to encoding this requirement in their
bindings.
2022-07-25 13:51:43 -04:00
Brad King
74ec6b63c2 cmFileCommand: Report keyword errors via argument parser results 2022-07-22 10:32:24 -04:00
Brad King
e98fd9d87e cmFileCommand: Use cm::optional for keyword argument presence 2022-07-20 16:03:12 -04:00
Brad King
f46b2e9142 cmArgumentParser: Model maybe-missing string with wrapper type
Bindings to `std::string` require one value.  Some clients have been
filtering `keywordsMissingValue` to support keywords that tolerate a
missing value.  Offer them a type-safe way to achieve this instead.
2022-07-07 09:49:04 -04:00
Brad King
e6d1e29ffa cmArgumentParser: Model maybe-empty and non-empty lists with wrapper types
Previously bindings to `std::vector<std::string>` required at least one
value.  Some clients have been filtering `keywordsMissingValue` to
support keywords followed by empty lists.  Instead, require clients to
specify whether a keyword's list can be empty as part of the binding
type.
2022-07-07 09:48:58 -04:00
Brad King
d21b391cde Merge topic 'file-TIMESTAMP-relative-path'
733801b57f file(TIMESTAMP): Interpret relative paths w.r.t. the source tree

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7440
2022-07-07 09:22:11 -04:00
TheBrokenRail
733801b57f file(TIMESTAMP): Interpret relative paths w.r.t. the source tree
Fixes: #23610
2022-07-06 09:28:21 -04:00
Brad King
bff468c988 cmFileCommand: Use cm::optional for keyword argument presence 2022-07-05 16:56:06 -04:00
Brad King
2873f41bd9 cmArgumentParser: Require callers to consider unparsed arguments 2022-07-05 16:35:01 -04:00
Brad King
1ee5a4a548 cmArgumentParser: Avoid allocating copies of keyword strings 2022-07-05 16:34:57 -04:00
Brad King
7c83265e59 file(ARCHIVE*): Simplify acceptance of empty list arguments
In `cmArgumentParser`, a keyword bound to a `std::vector<std::string>`
value is reported in the list of keywords with missing values if the
keyword appears followed by an empty list.  For cases where we want to
tolerate empty lists, clients need to filter out such keywords
themselves before producing an error message.  This may be improved in
the future, but that is out of scope here.

In commit c7e1198a23 (file: Add ARCHIVE_{CREATE|EXTRACT} subcommands,
2020-03-13, v3.18.0-rc1~530^2), a pattern for filtering out keywords
that accept empty lists was copied from commit c998c8d560
(file(GET_RUNTIME_DEPENDENCIES): Tolerate empty list arguments,
2020-01-22, v3.17.0-rc1~111^2~1) incorrectly in two ways:

* Keywords were included in the filter that do not accept empty lists.
* Keywords were not in sorted order, breaking the filter operation.

Those two bugs mostly canceled each other out, and the resulting
behavior was to correctly report keywords with missing values.
However, the `MTIME` keyword was accidentally accepted with no value
by pretending the keyword was not given at all.

Simplify the logic by removing keywords from the filters that should not
be there.  Leave `MTIME` in the filter for compatibility.
2022-06-29 17:43: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
Brad King
7c3169417d Merge topic 'curl-debug-callback'
e243b379ca cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callback

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !7288
2022-05-24 10:09:35 -04:00
Ben Boeckel
16e6e4e7dd cmFileCommand: remove an unnecessary cast
`cmCryptoHash::New` already returns a `unique_ptr`.
2022-05-24 09:09:44 -04:00
Ben Boeckel
aa3649eb04 clang-tidy: fix performance-unnecessary-copy-initialization lints 2022-05-24 09:09:44 -04:00
Brad King
e243b379ca cmFileCommand: Fix signature of CURLOPT_DEBUGFUNCTION callback
Curl documents that the callback should return type `int`.
2022-05-23 10:05:06 -04:00
Kasper Laudrup
0b7fd783f8 cmake -E tar: Add --touch option
Similar to GNU tar add a --touch option to the tar extract command to
skip extracting the timestamps from the files in the archive
effectively touching them as if they were just created.

Issue: #22746
2022-03-23 14:41:34 +01:00
m.klimenko
231872ddb0 file(DOWNLOAD): Add options to download a range 2022-02-15 22:08:06 +03:00
Alexey Edelev
fd0c285b12 file: Fix types of the OFFSET and LIMIT arguments
OFFSET argument cannot handle offsets bigger than INT_MAX because of
the atoi function, which is used to convert the argument string to integer.
Same applies for the LIMIT argument.
Use the steam based reading and 64-bit types to convert and store arguments
to avoid invalid values stored in the corresponding variables.

Fixes: #23076
2022-01-13 11:56:49 +01:00
Brad King
d009622769 Merge topic 'file-READ_ELF-capture-error'
41bebbe50a file: Restore error capture in undocumented READ_ELF mode

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !6853
2022-01-12 09:45:07 -05:00
Brad King
41bebbe50a file: Restore error capture in undocumented READ_ELF mode
Revise the error message added by commit 115ff6a347 (cmELF: Include the
ELF parsing code unconditionally, 2021-06-17, v3.22.0-rc1~557^2) to
honor the `CAPTURE_ERROR` option.  This is needed by the call site in
`BundleUtilities` to suppress errors on non-ELF files.

Fixes: #23074
2022-01-11 12:46:06 -05:00
Brad King
0d37dae5f9 cmFileCommand: Update for new signature of GetLineFromStream 2022-01-11 11:09:53 -05:00
Sean McBride
5ba6e8ac59 Source: Replace most calls to sprintf with snprintf 2021-10-25 18:23:13 -04:00
Seth R Johnson
fc92d6640b cmFileCommand: improve error message
Print full list of unresolved dependencies and a phrase that indicates
what about the file is unresolved.
2021-10-12 11:40:45 -04:00