b1fdab3cc1 source: Pass small and trivially copyable types by value
7829ea76ad source: Pass cmFileTime by value
99c10afc26 source: Pass trivial dap::*Event by value
0bcb8d6e3c source: Pass cmFileAPI::Object by value
964e992ec5 source: Pass cmCTestResourceAllocator::Resource by value
ee1c32b6d7 source: Pass cmBuildOptions by value
fa0e5906ff source: Pass cmStringRange by value
0c4040057a source: Pass cm::string_view by value
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10948
557c44b93e cmStrCat: use character literals where possible
23779057fd cmStrCat: combine neighboring arguments where possible
483d13daf4 ast-grep: add a rule to turn strings into characters
61743471d9 ast-grep: add a rule to find adjacent string literals in cmStrCat calls
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10790
Move logic from commit c85524a94a (Ensure stdin, stdout, and stderr pipes
are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit 96010cc968
(Ensure stdin, stdout, stderr FILE streams are open on Windows, 2024-01-24,
v3.29.0-rc1~65^2) to a dedicated source. Expose it through an `Init` class
constructor to make it optionally available during static initialization.
Issue: #26924
In commit 5aed3ee49d (cmSystemTools: Add GetLogicalWorkingDirectory,
2024-10-28, v4.0.0-rc1~528^2~6) we incorrectly trusted `PWD` to be a
normalized path so long as its realpath matches the current working
directory.
Fixes: #26870
5805461074 cmSystemTools: Simplify call to FindProgram for our own executable
db0e2574cb cmSystemTools: Restore FindProgram look-up of on-disk case on Windows
5d700abda4 Source: Simplify FindProgram calls
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10620
Remove the unnecessary `FindProgramPath` wrapper. Call the KWSys
`FindProgram` directly, without our CMake-specific wrapper, since
we follow-up with a `ToNormalizedPathOnDisk` anyway.
KWSys's `FindProgram` no longer looks up the actual case on disk. This
behavior change was inherited from the change to `CollapseFullPath`.
Extend commit 773b75e4ed (cmake: Explicitly look up on-disk case of
input paths on Windows, 2024-10-23, v4.0.0-rc1~589^2) to cover this by
wrapping `FindProgram` in a CMake-specific layer.
Issue: #20214
This was accidentally dropped by commit 622596c6b2 (cmSystemTools:
Re-implement ToNormalizedPathOnDisk without translation map, 2024-10-30,
v4.0.0-rc1~528^2~5). Previously it was done by `CollapseFullPath`.
`cm::PathResolver` intentionally does not expand `~` because it makes
sense only for transforming input paths. Teach `ToNormalizedPathOnDisk`
to handle it directly.
Fixes: #26827
In commit 823e1df54c (cmSystemTools: Implement GetRealPath on Windows,
2024-11-04, v4.0.0-rc1~521^2~1) we implemented the POSIX behavior that
resolves symlinks followed by '..' components. However, Windows just
removes them lexically. Also, we were not handling all junction types.
Instead, use `GetFinalPathNameByHandleW` via `uv_fs_realpath`.
Note that we previously attempted this in commit 640709e7db
(cmSystemTools: Implement GetRealPath on Windows, 2017-10-02,
v3.11.0-rc1~445^2~1) but reverted it in commit 83630d4918
(cmSystemTools: Revert GetRealPath implementation on Windows,
2018-05-29, v3.11.3~3^2) due to resolving `subst` drives. This time,
add code to re-`subst`itute the drive in the resolved path.
Fixes: #26750
Issue: #17206
We need it to restore behavior on Windows. Revert commit 16af27fd42
(cmSystemTools: Drop GetRealPathResolvingWindowsSubst, 2024-11-04,
v4.0.0-rc1~521^2), but with a cleaned up implementation.
Issue: #26750
Issue: #18033
Since commit 622596c6b2 (cmSystemTools: Re-implement
ToNormalizedPathOnDisk without translation map, 2024-10-30,
v4.0.0-rc1~528^2~5) we normalize input paths, while resolving symlinks
only if followed by `..` components, by using `cm::PathResolver`'s
`LogicalPath` mode. However, that approach assumes POSIX semantics for
resolving paths with symlinks and is incorrect on Windows.
On Windows, file system operations naively remove any component
preceding `..` regardless of whether it is a symlink. Prior to the
above commit, `ToNormalizedPathOnDisk` matched that behavior using
`CollapseFullPath` followed by `GetActualCaseForPath`. Restore it using
`cm::PathResolver`'s `CasePath` mode.
Issue: #26750
Extend the fix from commit 74c9d40876 (execute_process: Fix invocation
of .cmd/.bat with spaces, 2025-01-31) to work without relying on
conversion to a "short path", which may not exist. Instead, extending
the `cmd /c` wrapper to `cmd /c call` seems to support spaces directly.
Suggested-by: Alexandru Croitor <alexandru.croitor@qt.io>
Fixes: #26655
`mkdtemp` is not available on this architecture until SunOS 5.11.
Look up the symbol at runtime, and if missing, fall back to an
approximate implementation.
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.
* 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.
Issue: #26123
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 18.
* 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.
Fixes: #26123
d620d77d26 FindDoxygen: Rename `_Doxygen_dne_header` -> `_Doxygen_do_not_edit_header`
e7ff3cccea PushToAndroidDevice.cmake: Rename `cmake_parse_arguments` prefix
bc8621d999 Fix: A lot of typos in code found by `typos`
b33beb7af5 Help: Fix some typos found by `sphinx-lint`
78e45c2db6 Style: Replace TABs with spaces for indentation in some files
74e0173f66 Tests(NuGet): Fix the test to ignore empty and space-only lines
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10151
In commit 0994bc7929 (cmake: Preserve symlinks in references to itself
when possible, 2024-11-11) we stopped looking for resources using the
real path of the directory containing `cmake`. Restore it as a fallback
to support layouts like `/{bin -> usr/bin}/cmake`.
Fixes: #26570
When profiling Qt builds on macos, about 2.2% of a `cmake` invocation
was spent reading from `/dev/urandom`. Use a (thread)local rng to
mitigate this cost, particularly in `cmGeneratedFileStreamBase::Open`.
Most Unix-like systems drops the SETUID/SETGID bits when a file changes,
so after changing the RPATH, it is necessary to restore
the original file mode.
CMake's tools search relative to their own locations to find their
resources. Previously they always started at their own `realpath()`.
The intention was to support invocation through symbolic links to the
binaries where the resources can only be found under the real prefix:
/logical/prefix/bin/cmake -> /real/prefix/bin/cmake
/real/prefix/share/cmake
The generated build system refers to CMake's own tools and resources
through the `/real/prefix`. This is not desirable in the case that the
`/logical/prefix` is meant as the canonical location and uses symbolic
links for both tools and resources as an implementation detail:
/logical/prefix/bin/cmake -> /real/prefix/bin/cmake
/logical/prefix/share/cmake -> /real/prefix/share/cmake
In this case, the generated build system should refer to CMake's own
tools and resources through the `/logical/prefix`. This way the
`/real/prefix` can be changed, and the symbolic links updated,
without breaking already-generated build systems.
Fixes: #19849Fixes: #21059
Inspired-by: Carlo Cabrera <github@carlo.cab>
Inspired-by: Rodger Combs <rodger.combs@gmail.com>