summaryrefslogtreecommitdiffstats
path: root/Source/cmSystemTools.h
Commit message (Collapse)AuthorAgeFilesLines
* file(ARCHIVE_CREATE): add WORKING_DIRECTORY optionYuri Witte2024-09-111-0/+1
| | | | | Fixes: #25260 Issue: #21653
* cmSystemTools: Add GetComspec method to get cmd on WindowsAlexey Edelev2024-08-211-0/+3
| | | | | | The function attempts to read the path to cmd executable from the COMSPEC environment variable. Falls back to cmd.exe if the respective environment variable is not set or path doesn't exist.
* cmSystemTools: Revise MoveFileIfDifferent to return cmsys::StatusAlex Turbov2024-07-181-2/+2
| | | | Help callers recover errors without relying on global state.
* cmSystemTools: Add CMake config directoryMartin Duffy2024-07-031-0/+4
|
* Merge topic 'ctest-windows-std-handles'Brad King2024-06-141-6/+0
|\ | | | | | | | | | | | | | | e4d0169107 ctest: Fix spurious build failures with CTEST_USE_LAUNCHERS on Windows Acked-by: Kitware Robot <kwrobot@kitware.com> Tested-by: buildbot <buildbot@kitware.com> Merge-request: !9598
| * ctest: Fix spurious build failures with CTEST_USE_LAUNCHERS on WindowsBrad King2024-06-141-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the stdio handle inheritance suppression originally added by commit f262298bb0 (... do not inherit pipes in child procs for ctest so it can kill them, 2007-09-11, v2.6.0~1136). It's not clear what problem it was trying to solve, was only done in `ctest` and not `cmake`, and since commit 9c3ffe2474 (BUG: fix problem with stdout and stderr not showing up in ms dos shells, 2007-09-25, v2.6.0~1066) has not been done in `ctest` launched under interactive consoles. Furthermore, the code has been spuriously breaking stdio when `ctest` is started with both stdout and stderr connected to the same pipe, such as when `ctest --launch` is used under `ninja`. This is because it used `DuplicateHandle` with `DUPLICATE_CLOSE_SOURCE` on the stdout handle and then the stderr handle. If the handles are the same, then the stderr handle becomes invalid in between these operations, leading to likely-undefined behavior. Since commit 96b3dd329e (cmCTestLaunchReporter: Replace cmsysProcess with cmUVProcessChain, 2023-07-26, v3.28.0-rc1~138^2~2) this became more noticeable because `uv_spawn` performs additional verification on stdio handles. This could be fixed by instead suppressing inheritance via SetHandleInformation(h, HANDLE_FLAG_INHERIT, 0); However, the functionality no longer seems necessary, so remove it.
| * Revert use of libuv for process execution for 3.28Brad King2024-01-241-16/+5
|/ | | | | | | | | | | | | | Wide use of CMake 3.28.{1,0[-rcN]} has uncovered some hangs and crashes in libuv SIGCHLD handling on some platforms, particularly in virtualization environments on macOS hosts. Although the bug does not seem to be in CMake, we can restore stability in the CMake 3.28 release series for users of such platforms by reverting our new uses of libuv for process execution. Revert implementation changes merged by commit 4771544386 (Merge topic 'replace-cmsysprocess-with-cmuvprocesschain', 2023-09-06, v3.28.0-rc1~138), but keep test suite updates. Issue: #25414, #25500, #25562, #25589
* cmSystemTools::RunSingleCommand(): Replace cmsysProcess with cmUVProcessChainKyle Edwards2023-08-291-1/+0
| | | | And pass OUTPUT_PASSTHROUGH in one call where it was missing.
* cmCTestScriptHandler: Replace cmsysProcess with cmUVProcessChainKyle Edwards2023-08-291-4/+16
| | | | And update cmSystemTools::WaitForLine() to use cmUVProcessChain.
* cmSystemTools: move `ComputeCertificateThumbprint` to the only consumerBen Boeckel2023-08-081-7/+0
| | | | | There's no need to have this API on `cmSystemTools` with only a single consumer.
* cmSystemTools: remove `ComputeFileHash` methodBen Boeckel2023-08-081-5/+0
| | | | No longer used.
* cmSystemTools: remove `ComputeStringMD5` methodBen Boeckel2023-08-081-3/+0
| | | | No longer used.
* IWYU: Update for Debian 12 CI jobBrad King2023-07-281-1/+1
| | | | | | `include-what-you-use` diagnostics, in practice, are specific to the environment's compiler and standard library. Update includes to satisfy IWYU for our CI job under Debian 12.
* macOS: Add support for linking against .xcframework foldersKyle Edwards2023-07-261-0/+3
| | | | Issue: #21752
* cmSystemTools: Add helpers for reading and parsing PATH env varsBrad King2023-02-231-0/+3
|
* file(COPY_FILE): Add option to retry on Windows if input access failsBrad King2022-11-171-0/+6
| | | | | | | | 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.
* cmSystemTools: Remove unused CopySingleFile overloadBrad King2022-11-171-2/+0
|
* cmSystemTools: Provide quiet link creation methodsBrad King2022-10-061-4/+6
| | | | Offer variants that let the caller handle error messages.
* cmSystemTools: Add MakeTempDirectoryMatthew Woehlke2022-09-051-0/+25
| | | | | | | | | | | | Add a cross-platform wrapper over mkdtemp. This will allow us to create guaranteed-unique directories. On POSIX platforms, this is simply a wrapper over mkdtemp. On Windows, we take a brute-force approach using C++11's random facilities and relying on attempts to create an existing directory resulting in an error. (This approach is very possibly how mkdtemp is implemented internally, and should be suitable for any platform if needed, although at present it only uses a partial set of substitution characters since Windows likely implies a case-insensitive file system.)
* cmake -E env: Add --modify flagAlex Reinking2022-08-171-0/+3
| | | | | | | | | | | | | | | | | | | | | | When `cmake -E env` is given the `--modify` flag, try to parse the following argument as an `ENVIRONMENT_MODIFICATION` operation and apply it to the environment. This generalizes `--unset=`: 1. When implementing `ENVIRONMENT_MODIFICATION` features for other CMake commands, the `MYVAR=OP:VALUE` strings do not need to be translated to OP-specific flags. 2. This provides a natural and consistent extension point to introduce new operations without introducing very many flags. 3. Users need to learn only one syntax to access the same functionality. There is one difference between the behavior here as compared to CTest's interpretation of the `ENVIRONMENT_MODIFICATION` test property. The `MYVAR=reset:` command when run in `cmake -E env` will reset `MYVAR` to whatever its value was when `cmake -E env` launched, rather than try to checkpoint after plain `MYVAR=VALUE` options. This makes `MYVAR=VALUE` and `--modify MYVAR=set:VALUE` semantically equivalent.
* cmCTestRunTest: Implement the ENVIRONMENT test property with EnvDiff tooAlex Reinking2022-08-151-0/+9
| | | | | | | | Going through the same internal API for both `ENVIRONMENT` and `ENVIRONMENT_MODIFICATION` properties will make it easier to implement checkpointing for `MYVAR=reset:` more efficiently if the need ever presents itself. It also makes the two-stage nature of the environment mutation clearer in the code itself.
* cmSystemTools: Add EnvDiff class to hold ENVIRONMENT_MODIFICATION logicAlex Reinking2022-08-151-0/+27
| | | | Prepare to re-use this logic when enhancing `cmake -E env`.
* cmSystemTools: Factor out method to get Windows OS versionBrad King2022-07-251-0/+8
| | | | Factor the implementation out of `cmGlobalGenerator`.
* cmSystemTools: Fix 'ErrorOccurred' spellingFeRD (Frank Dana)2022-06-131-13/+13
| | | | | | | | 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.
* cmake-presets: add ${pathListSep} macroErin Melucci2022-05-121-0/+3
| | | | Fixes: #23282
* cmake -E tar: Add --touch optionKasper Laudrup2022-03-231-1/+9
| | | | | | | | 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
* bootstrap: Do not declare cmSystemTools functions that are not implementedBrad King2021-10-271-0/+4
| | | | Convert runtime error messages into compile-time errors.
* cmSystemTools::VersionCompare: use std::string for argumentsMarc Chevrier2021-09-171-1/+4
|
* Xcode: add support for embedding dynamic librariesLucas SOLTIC2021-09-131-1/+5
|
* cmSystemTools: Add SetRPath() methodKyle Edwards2021-06-041-1/+5
|
* cmMessenger: Pass title inside a metadata structureMarius Messerschmidt2021-05-191-1/+5
|
* cmSystemTools: Adopt RelativeIfUnder helperBrad King2021-05-171-0/+6
| | | | This returns a relative path if it does not start in `../`.
* Source: Fix typos and spelling in commentsJosef Angstenberger2021-05-071-1/+1
|
* cmSystemTools: Return KWSys Status from CreateLink and CreateSymlinkBrad King2021-04-151-6/+6
|
* Update CMake code using KWSys to account for Status return valuesBrad King2021-04-141-0/+1
| | | | | | KWSys as of 2021-04-14 changed the return type of `SystemTools` operations from `bool` to `Status`. Update our call sites. This may improve error reporting accuracy in a few places.
* Refactor: Add cmSystemTools::GetSystemName()Kyle Edwards2021-03-151-0/+3
| | | | And use it for CMAKE_HOST_SYSTEM_NAME and CMAKE_SYSTEM_NAME.
* cmSystemTools: add utilities to copy a file with error handlingBen Boeckel2021-03-091-0/+18
|
* cmSystemTools: Add RenameFile option to not replace destinationBrad King2021-03-041-1/+8
|
* cmSystemTools: Add RenameFile signature to capture the error messageBrad King2021-03-041-0/+8
|
* Makefile dependencies: ensure long paths are used on WindowsMarc Chevrier2021-01-091-0/+6
|
* CMake GUI: Add "CMake Reference Manual" help itemKyle Edwards2020-09-301-0/+1
| | | | And switch the ordering of "Help" and "About".
* file(ARCHIVE_CREATE): Add option to control compression levelAsit Dhal2020-09-211-1/+2
| | | | Fixes: #21125
* Modernize: Use #pragma once in all header filesKitware Robot2020-09-031-4/+1
| | | | | | | | | | | | | | | | #pragma once is a widely supported compiler pragma, even though it is not part of the C++ standard. Many of the issues keeping #pragma once from being standardized (distributed filesystems, build farms, hard links, etc.) do not apply to CMake - it is easy to build CMake on a single machine. CMake also does not install any header files which can be consumed by other projects (though cmCPluginAPI.h has been deliberately omitted from this conversion in case anyone is still using it.) Finally, #pragma once has been required to build CMake since at least August 2017 (7f29bbe6 enabled server mode unconditionally, which had been using #pragma once since September 2016 (b13d3e0d)). The fact that we now require C++11 filters out old compilers, and it is unlikely that there is a compiler which supports C++11 but does not support #pragma once.
* cmSystemTools: Define directory-specific Windows filesystem retry settingsBrad King2020-08-271-0/+1
| | | | Inspired-by: Ron W Moore <webbtrail@gmail.com>
* Restore handling of build directory inside a symlinked pathBrad King2020-07-021-0/+3
| | | | | | | | | | | | | | | 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
* Revise include order using clang-format-6.0Kitware Robot2019-10-011-6/+9
| | | | | 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.
* cmstd: Modernize CMake system headersMarc Chevrier2019-09-201-1/+1
| | | | | | | | | | | | | | 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
* clang-tidy: modernize-deprecated-headersRegina Pfeifer2019-09-161-1/+1
|
* cmSystemTools: introduce MoveFileIfDifferent()Rolf Eike Beer2019-09-091-0/+4
|
* clang-tidy: Replace typedef with usingRegina Pfeifer2019-09-031-2/+2
|