summaryrefslogtreecommitdiffstats
path: root/Source/cmFileCommand.cxx
Commit message (Collapse)AuthorAgeFilesLines
* file(DOWNLOAD/UPLOAD): Require minimum TLS 1.2 by defaultBrad King2024-09-261-0/+17
| | | | Fixes: #25701
* file(DOWNLOAD/UPLOAD): Verify TLS server certificate by defaultBrad King2024-09-241-4/+32
| | | | | | | | | | If the connection fails in a way that might be a certificate error, and verification was enabled by the new default, mention environment variable `CMAKE_TLS_VERIFY` in the diagnostic to help users that were relying on the old behavior turn off server certificate verification in their environment. Fixes: #23608
* cmFileCommand: Clarify names and logic using optional<bool>Brad King2024-09-241-36/+36
|
* Merge topic 'file-REAL_PATH-warn-non-existing'Brad King2024-09-131-0/+7
|\ | | | | | | | | | | | | 00c1161b01 file(REAL_PATH): Warn on non-existing paths Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !9806
| * file(REAL_PATH): Warn on non-existing pathsAlex Overchenko2024-09-121-0/+7
| | | | | | | | | | | | | | The command is documented to work only for cases that the referenced path exists. Fixes: #26260
* | file(ARCHIVE_CREATE): add WORKING_DIRECTORY optionYuri Witte2024-09-111-1/+4
|/ | | | | Fixes: #25260 Issue: #21653
* Merge topic 'macos-curl-user-agent'Brad King2024-08-151-1/+4
|\ | | | | | | | | | | | | | | 1a74f95656 file(DOWNLOAD): Fix User-Agent to use run-time curl version Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9726
| * file(DOWNLOAD): Fix User-Agent to use run-time curl versionBrad King2024-08-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | If CMake is linked to a system-provided curl shared library, the version at run-time may not match the `LIBCURL_VERSION` at build time. Look up the run-time curl version to populate the User-Agent string. This is particularly important since commit d3cbee99e3 (macOS: Prefer building with system-provided curl, 2024-05-09, v3.30.0-rc1~130^2~1) switched to building our official binaries on macOS against the system provided curl shared library. Fixes: #26209
* | Merge topic 'curl-http2'Brad King2024-08-151-2/+2
|\ \ | | | | | | | | | | | | | | | | | | | | | 7486f468fb curl: Avoid using HTTP/2 with curl 8.7.x due to bug in error codes Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !9728
| * | curl: Avoid using HTTP/2 with curl 8.7.x due to bug in error codesBrad King2024-08-131-2/+2
| |/ | | | | | | | | | | | | | | | | curl 8.7.x has a bug in HTTP/2 error codes introduced by commit `0dc036225` (HTTP/2: write response directly, 2024-01-31, `curl-8_7_0~230`) and fixed by commit `5c59f9142` (http2 + ngtcp2: pass CURLcode errors from callbacks, 2024-04-18, `curl-8_8_0~181`). Fixes: #26200
* | Merge topic 'macos-curl-backend'Brad King2024-07-181-0/+2
|\ \ | |/ | | | | | | | | | | | | | | f2596dfa0e macOS: Work around bug in system curl 8.{3,4,5} LibreSSL backend Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Acked-by: Ben Boeckel <ben.boeckel@kitware.com> Merge-request: !9663
| * macOS: Work around bug in system curl 8.{3,4,5} LibreSSL backendBrad King2024-07-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit d3cbee99e3 (macOS: Prefer building with system-provided curl, 2024-05-09, v3.30.0-rc1~130^2~1) CMake uses the macOS-provided curl, which uses the LibreSSL backend by default. This exposes us to curl issue 12525, created and fixed by the following upstream curl commits: * commit `bec0c5bbf` (openssl: switch to modern init for LibreSSL 2.7.0+, 2023-08-07, `curl-8_3_0~201`) * commit `9f2d2290d` (openssl: re-match LibreSSL deinit with init, 2023-12-15, `curl-8_6_0~219`) Work around the bug by preferring the secure-transport backend by default on the problematic versions of curl.
* | file(MAKE_DIRECTORY): Add optional RESULT keyword to capture failure.Asit Dhal2024-06-241-9/+60
|/ | | | Fixes: #26041
* file: Add undocumented READ_MACHO subcommand on macOSRené Bertin2024-06-041-0/+2
| | | | | | Provide a way to parse the architectures of a Mach-O binary. Issue: #25952
* file(): TOUCH, TOUCH_NOCREATE and MAKE_DIRECTORY accept empty listsCraig Scott2024-05-311-8/+17
| | | | | | | | | Projects may be generating a list of files or directories to pass as arguments to file(TOUCH), file(TOUCH_NOCREATE), or file(MAKE_DIRECTORY). Those lists might end up being empty, so rather than requiring at least one item, allow an empty list. Fixes: #24897
* file(DOWNLOAD|UPLOAD): Add CMAKE_TLS_VERIFY environment variableBrad King2024-03-301-0/+12
| | | | Issue: #23608
* file(DOWNLOAD|UPLOAD): Avoid unnecessary CMAKE_TLS_VERIFY variable lookupBrad King2024-03-301-4/+16
| | | | | If the `TLS_VERIFY` option is given explicitly, we do not need to check the variable.
* cmGlobCacheEntry: Add helper to carry CONFIGURE_DEPENDS glob cache argumentsArctic Lampyrid2024-03-191-4/+10
|
* file(DOWNLOAD|UPLOAD): Add CMAKE_TLS_VERSION environment variableBrad King2024-02-281-0/+12
| | | | Issue: #25701
* file(DOWNLOAD|UPLOAD): Add CMAKE_TLS_VERSION variableBrad King2024-02-281-0/+12
| | | | Issue: #25701
* file(DOWNLOAD|UPLOAD): Add TLS_VERSION option for https connectionsBrad King2024-02-281-0/+44
| | | | | | | Add an option to specify the minimum allowed TLS version for https connections. Issue: #25701
* file: `STRINGS` + `REGEX` store match resultsCristian Le2024-01-091-0/+37
| | | | Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
* Merge topic 'cmFileCopier-error-loss'Brad King2023-12-051-6/+5
|\ | | | | | | | | | | | | | | | | | | 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
| * errors: avoid constructing a stream before getting the last errorBen Boeckel2023-12-021-6/+5
| | | | | | | | | | Constructing a stream may involve operations that change the global error state. Avoid the streams by using `cmStrCat` instead.
* | cmFileCommand: combine string literalsBen Boeckel2023-10-201-7/+9
|/
* Source: Remove redundant FileIsSymlink checksscivision2023-09-181-2/+1
| | | | | | Replace `FileExists || FileIsSymlink` with `PathExists`. The latter does not resolve symlinks, so this is OK for use with broken symlinks, files, and directories.
* file: Clarify CMake only drops RPATHS's it addedRobert Maynard2023-08-151-2/+4
|
* Merge topic 'file-GENERATE-arg-parsing'Brad King2023-08-081-1/+2
|\ | | | | | | | | | | | | | | 88f90a72f1 file(GENERATE): Restore INPUT|CONTENT parse checking Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8694
| * file(GENERATE): Restore INPUT|CONTENT parse checkingEvan Wilde2023-08-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | file(REAL_PATH): resolve symlinks before '..' componentsRobert Maynard2023-07-201-3/+53
| | | | | | | | | | | | | | | | 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.
* | cmList: Add container conversion to stringMarc Chevrier2023-06-221-7/+8
|/
* file(REAL_PATH): Ensure same behavior as get_filename_component(REALPATH)Marc Chevrier2023-03-201-4/+3
| | | | Fixes: #24605
* file: Avoid using deprecated curl progress callbackBrad King2023-01-271-9/+21
|
* file(MAKE_DIRECTORY): Provide a more descriptive error messageTerence Noone2022-12-081-2/+4
| | | | | | Previously, MAKE_DIRECTORY would print `problem creating directory: {}`, which was very unhelpful for debugging. Extend the message with the OS error string.
* file(COPY_FILE): Add option to retry on Windows if input access failsBrad King2022-11-171-1/+7
| | | | | | | | 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.
* file(ARCHIVE_CREATE): Allow higher compression level for ZstdAmir Masoud Abdol2022-11-161-7/+16
| | | | | | | | 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
* cmGeneratorExpression: Require cmake instanceKyle Edwards2022-11-111-2/+4
|
* file(DOWNLOAD EXPECTED_HASH): better error message when download failedAurelien Regat-Barrel2022-11-091-5/+9
|
* file(DOWNLOAD): Fix LOG with EXPECTED_HASH on download failureAurelien Regat-Barrel2022-10-301-5/+7
| | | | | | | | | 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
* cmSystemTools: Provide quiet link creation methodsBrad King2022-10-061-4/+16
| | | | Offer variants that let the caller handle error messages.
* Merge topic 'parse-large-int'Brad King2022-09-211-2/+8
|\ | | | | | | | | | | | | | | | | 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
| * file: Avoid strange istringstream crash in cmake.org binaries on Alpine LinuxBrad King2022-09-201-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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
* | file(DOWNLOAD): Fix message for existing file with matching hashMichael Hirsch2022-08-231-1/+1
| | | | | | | | | | | | | | | | | | 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.
* | cmFileCommand: Capture list of parsed keywords via bindingBrad King2022-07-251-7/+8
| |
* | cmArgumentParser: Drop unused keywordsMissingValue argument to Parse()Brad King2022-07-251-3/+2
| | | | | | | | | | All clients have been converted to encoding this requirement in their bindings.
* | cmFileCommand: Report keyword errors via argument parser resultsBrad King2022-07-221-97/+67
| |
* | cmFileCommand: Use cm::optional for keyword argument presenceBrad King2022-07-201-32/+18
| |
* | cmArgumentParser: Model maybe-missing string with wrapper typeBrad King2022-07-071-24/+14
| | | | | | | | | | | | 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.
* | cmArgumentParser: Model maybe-empty and non-empty lists with wrapper typesBrad King2022-07-071-44/+28
| | | | | | | | | | | | | | | | 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.
* | Merge topic 'file-TIMESTAMP-relative-path'Brad King2022-07-071-1/+5
|\ \ | | | | | | | | | | | | | | | | | | | | | 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