e420259ecc libarchive: Restore compilation of archive_parse_date within CMakeLib
5b530ba347 libarchive: Set build options the way we need for CMake
dbcd6402c3 Utilities: Update hard-coded try_compile results for libarchive 3.8.9
357710687f Merge branch 'upstream-LibArchive' into update-libarchive
94ae161ab5 LibArchive 2026-07-28 (27cbc782)
46ccf27ae3 libarchive: Update script to get 3.8.9
16984b0124 ctest: Fix STOP_TIME for vendored archive_parse_date from libarchive 3.8.8+
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12398
libarchive commit `422aae80ae` (Date parsing: reject date components
with numbers of more than 4 digits, 2026-05-07), backported to version
3.8.8 by libarchive commit `8cf7393f98` (Merge pull request `#3010`...,
2026-05-07, `v3.8.8~142`), disallows our non-standard hyphen-free date
format. Convert to a standard format.
The TRANSFORM action registry held one live action instance per action for
the whole process, and each instance carried per-call state: a raw Selector
pointer, REPLACE's helper, APPEND/PREPEND's operands. That was harmless
while every action ran to completion uninterrupted, but commit c7af6e94d8
(list(TRANSFORM): Add PREDICATE selector, 2026-04-08, v4.4.0-rc1) added a
selector that runs a user function once per element, interleaved with the
transform. User code reentering list(TRANSFORM) with the same action now
rebinds the shared instance mid-flight. That produces silently wrong
results, and a use-after-free once any element is transformed after the
reentering one. It needs no unusual code to hit: a predicate calling
find_package(Python) reaches list(TRANSFORM ... REPLACE) inside FindPython's
own module.
Make action objects immutable and per-call. Operands and the selector become
constructor arguments, Initialize is deleted, and the registry becomes a
constexpr table of metadata with a MakeTransformAction factory. The
InSelection guard, duplicated in all eight actions, moves into the base class.
This also closes a second hole in the same machinery. TransformActionApply
overrode only the vector form of Initialize, so transform(APPLY, "f",
selector) dispatched to the empty two-argument virtual in the base, left
Selector null, and dereferenced it. With no virtual Initialize left to
inherit, an APPLY action without a cmMakefile is no longer constructible, so
the throwing stub that guarded the vector form is no longer needed.
Close a third, from commit 651f82642c (Add APPLY action for list(TRANSFORM),
2026-04-08, v4.4.0-rc1): the cmMakefile overload performs APPLY
unconditionally but validated only the arity of the action passed to it.
APPEND, PREPEND and APPLY all take one argument, so transform(APPEND, "x",
makefile) passed validation and then silently ran APPLY, calling "x" as a
function instead of appending it. Reject any action but APPLY up front.
That path is unreachable from CMake code, since HandleTransformCommand only
selects the overload for APPLY, and Tests/CMakeLib has no cmMakefile to drive
it with, so it carries no test.
Document the predicate's evaluation order while here. It runs once per
element, immediately before that element would be transformed. The manual
did not state the timing, which matters precisely because a predicate that
reenters list(TRANSFORM) observes the outer call mid-flight.
Fixes: #28031
Reply file names embed the configuration name verbatim. Reconfiguring
a build tree with a build type that differs from the previous one only
in case (e.g. Debug -> debug) makes CMake write a reply whose name also
differs only in case from the existing file. On a case-insensitive
filesystem the write is skipped because the name already exists, but
RemoveOldReplyFiles compared on-disk names to the just-written names
textually and deleted the surviving file, leaving the reply index
citing a target or directory reply that no longer exists on disk.
Prune reply files by file identity via cmSystemTools::GetFileId instead
of by name, so an on-disk entry that aliases a reply we just wrote is
kept. An entry whose identity cannot be obtained is retained rather
than deleted.
Fixes: #28022
Refactor cmRST to split parsing into two phases; one which processes
directives and collects lines to be output, and a second which performs
the actual output. In particular, this fixes substitutions not being
replaced when the definition appears after usage.
To facilitate this, refactor how replacement definitions are collected
so that content included via `toctree` has a separate replacement
context.
Also, record the length of the previously output line, so that when
headings are detected, we can reconstruct the markup to match the
(potentially changed by replacements) final length of the header text.
Our Sphinx extensions recognize several roles that missed being added to
our internal C++ parser (`cmRST`). Update the latter with the missing
roles, bringing the two back in sync. This addresses several roles that
`cmRST` was previously leaving as inline markup that more appropriately
should be converted to literal text.
Use a named semaphore polled from the libuv event loop to share GNU Make
job slots on Windows. Cover token ordering, bounded draining, and
teardown, and document the new support.
Fixes: #27968
Move some target related enumeration types from `cmStateTypes.h` to a
new header, as these really aren't "state" types. Also, make
`TargetType` a strongly-typed enumeration.
Add a COMPARATOR form to $<LIST:SORT> that orders the list by a caller-defined
rule: a <body> evaluated per comparison with the two elements bound to $<_0>
and $<_1>, yielding "1" when the first should sort before the second. This
brings the custom ordering of list(SORT ... COMPARATOR) to generate time, so
elements can be ordered by target properties or any other generator expression.
CASE: and ORDER: still apply, while COMPARE: is rejected because the body
defines the ordering.
Fixes: #27892
Allow a binding operation to bind more than one operand at once, exposed as
$<_0>, $<_1>, .... A single value remains the common case, but the upcoming
SORT COMPARATOR must bind the two elements being compared, so the binding
becomes an indexed frame and $<_1> is added. Referencing an index the active
binding does not provide is reported as an error.
Issue: #27892
Let $<LIST:FILTER> select elements by an arbitrary condition: PREDICATE keeps or
drops each element according to a <body> evaluated with $<_0> bound,
complementing the existing regular-expression form. Also accept an explicit
REGEX keyword before the pattern so the regex and predicate forms read
symmetrically; the bare pattern keeps working.
Issue: #27892
Add a PREDICATE selector to $<LIST:TRANSFORM> that chooses which elements to
transform by evaluating a <body> per element (with $<_0> bound) and acting on
those for which it yields "1". This selects by computed condition instead of
the fixed AT/FOR/REGEX positions, so any generator expression -- including
target queries -- can decide where an action applies. It works with both the
canned actions and APPLY.
Issue: #27892
Add an APPLY action to $<LIST:TRANSFORM> that evaluates an arbitrary <body>
once per selected element, with $<_0> bound to the element, so a list can be
mapped through any generator expression at generate time. Unlike the
configure-time list(TRANSFORM ... APPLY <function>) command, the genex form has
no side effects and returns the body's value directly, and a list-valued result
expands into multiple elements.
The body evaluates in its own binding scope, so nested APPLY actions can shadow
$<_0>, and context-sensitive state it observes (such as target dependencies)
still propagates to the enclosing expression. APPLY accepts the same
AT/FOR/REGEX selectors as the canned actions.
Issue: #27892
Introduce "binding operations": generator expressions that evaluate a <body>
once for each value they supply, with $<_0> expanding to that value. This is
the foundation the $<LIST:TRANSFORM,...,APPLY> action and the predicate
selectors build on, letting a <body> refer to the element being processed.
Using $<_0> outside a binding operation is reported as an error rather than
silently expanding to nothing.
Issue: #27892
When a built-in cache variable is set via `-D <var>=<value>` with no
help text supplied, populate `HELPSTRING` from the built-in
documentation table (sourced from `Help/variable/*.rst` and the
per-language pattern manuals). Project-defined and unknown variables
continue to receive the legacy "No help, variable specified on the
command line." sentinel.
The cache entry's type and value are left untouched: type stays
`UNINITIALIZED` for bare `-D` and an explicit `-D <var>:TYPE=<value>`
is honored as before. The `cmCacheManager::LoadCache` path is not
modified, so reload of existing caches is a fixed point.
Fixes: #27830
The existing tests use "C:/CMakeLists.txt", which is only absolute on
Windows. ToNormalizedPathOnDisk resolves relative paths against the
working directory, so give the tests a platform-appropriate absolute
path via kTestSourcePath.
Add three tests that set breakpoints using a different letter case
than the path passed to SourceFileLoaded or GetBreakpoints, covering
all three NormalizePath call sites. The tests create a real file on
disk so that ToNormalizedPathOnDisk can resolve the canonical case,
and skip gracefully on platforms where ToNormalizedPathOnDisk does
not correct on-disk case (case-sensitive filesystems, or CYGWIN which
is treated as POSIX).
The POSIX pipe read wrappers stored the return of ::read() into an
unsigned result, so a negative count (e.g. EBADF from a concurrent
close on another thread) became SIZE_MAX. ContentReader::buffer()
would then try to grow its deque by ~18 exabytes and crash with
either std::length_error (glibc) or a stack smash (libc++). Treat
any non-positive ::read() return as EOF/error, close the pipe, and
return 0 so the peer's SessionThread observes a clean empty payload.
cmDebuggerPipeClient is test-only infrastructure; production cmake
is always the pipe server. Production close() assumes sequential
access, which holds in normal use (the adapter destructor joins
SessionThread before closing the connection). The new abrupt-
disconnect test however needs to wake a sibling thread blocked in
read() on the same fd, which Linux ::close() does not do.
Add a ShutdownForTesting() method that calls shutdown(SHUT_RDWR)
without freeing the fd, so any concurrent blocking read wakes
with a clean zero-length return. On Windows, CloseHandle already
cancels pending overlapped I/O, so the helper just forwards to
close(). Use it from testProtocolWithPipesAbruptDisconnect in
place of close().
When a DAP client closes the pipe (or crashes), getPayload() returns an
empty functor without triggering the onError handler, so SessionActive
is never set to false and the session thread spins in a tight loop at
100% CPU. Handle the empty-payload case with the same cleanup performed
by the onError and DisconnectRequest handlers.
testProtocolWithPipesAbruptDisconnect drives the DAP handshake and then
closes the client side of the pipe without sending a DisconnectRequest.
The test deliberately avoids ReportExitCode so that no concurrent write
triggers the dap::Session error handler and masks the busy-loop
condition; if the SessionThread spins on EOF, the adapter destructor
blocks in SessionThread.join() and the test fails on a 10-second
timeout.
Fixes: #27743
Modify cmListFile[Parser] to use cmMakefile rather than cmMessenger as
the interface for issuing messages. This is necessary to provide a
context for diagnostic messages so that they can be controlled via the
diagnostic state (which is not owned by cmMessenger).
Note that we actually bypass the cmMakefile when issuing errors, as
these cannot be disabled (so the diagnostic context doesn't matter), and
we want the calling cmMakefile to still be able to issue its own errors,
which would be suppressed if the cmMakefile has already issued an error.
To manage the generation step, introduce cmGeneratorFileSet and
cmGeneratorFileSets classes.
These reorganizations of the code are done in preparation of the
implementation of SOURCES file set type as well as user's file set types.
Issues: #27550, #27383
Tweak ArgumentParser::ParseResult to store errors as a set, rather than
concatenating them. Add a new method that a) also optionally checks for
unknown arguments, and b) reports errors using the `SetError` method of
`cmExecutionStatus`, which allows callers to `return false`, which is
less surprising when an error occurs. This improves consistency at call
sites, reduces duplication by moving the common task of complaining
about unknown arguments to a reusable method, and also produces somewhat
more concise messages in the case that multiple errors occurred.
Note that, for some reason, the parser is sometimes generating duplicate
errors, hence the use of a set rather than a list.
`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 13. Some patterns:
* Types named in virtual `override` signatures no longer require
includes since the overridden signature already names them.
* A function argument's type needs to be included even if its constructor
is called only by implicit conversion. For example, constructing a
`std::function` from a lambda now requires `<functional>`.
* Some prior mysterious `<type_traits>` inclusions are no longer required.
40b093649b cmake: Avoid calling GetCMakeListFile with empty directory
f6b3ba5f55 CMP0198: Maintain CMAKE_PARENT_LIST_FILE only when configuring projects
3593aa59ef cmake: Replace working mode with role
accfa7fa81 cmake: Infer command failure action from role
e290d4f2a3 cmake: Infer command set from role
bfaaec6179 cmake --workflow: Convert implementation to internal role
ea5d04975e cmake --build: Convert implementation to internal role
0b83750e14 cmake: Clarify name of role of internal instances
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11395