Extend the interrupt-flush mechanism already used for cmakeBuild and
cmakeInstall to ctest, so that a user interrupt (e.g. Ctrl+C) still writes
the overall ctest instrumentation snippet, marked with interruptSignal,
before exiting.
On interrupt CTest stops scheduling further tests at every launch site,
skips the postCTest hook, forces a non-zero exit status, and preserves the
checkpoint file so that a later 'ctest -F' can resume the interrupted test
set.
Issue: #27859
The install({TARGETS, EXPORT}) versions of the command now accept ALIAS
targets. The behavior is identical to what would happen if the name of
the target that the ALIAS references were put instead. The
export(TARGETS) command also has the same support and behavior for ALIAS
targets now.
Closes: #20979
17094eb572 ALIAS: Add test for generator expressions with ALIAS targets
5f8cc64695 ALIAS: Add support for add_dependencies for ALIAS targets
79e421b053 ALIAS: Add support for target_* commands
3b327695aa ALIASED_TARGET: Make property read-only
a121419908 ALIAS: Add support for set_property and set_target_properties commands
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12207
The add_dependencies command currently accepts ALIAS targets for
<target-dependencies> which resolve to the referenced target. This further
relaxes the command to accept an ALIAS <target> where the command will
add the dependencies to the target which the alias references.
Now that set_property and set_target_properties support ALIAS targets,
we need to extend support to all the target_* type commands that modify
target properties.
Relaxes target_compile_definitions, target_compile_features,
target_compile_options, target_include_directories,
target_link_directories, target_link_libraries, target_link_options,
target_precompile_headers, and target_sources to now accept ALIAS
targets. These commands set properties on the target which the alias
references.
The ALIAS_GLOBAL property is read-only, so ALIASED_TARGET should be as
well. Even when set, there is no way to read the property value, so this
change gives an explicit error for users.
Currently, getting properties from an ALIAS target retrieves the property
from the target which the alias references while setting properties results
in an error. This relaxes set_property and set_target_properties to
accept ALIAS targets and act on the referenced target, mirroring the get
behavior.
An error is raised when setting ALIAS_GLOBAL or ALIASED_TARGET on an ALIAS
target.
Closes: #19445
cmCTestLaunch, which backs ctest --launch and ctest --instrument,
derived its exit code from the child's SpawnResult and ExitStatus but
ignored TermSignal. On POSIX a command killed by a signal reports
ExitStatus 0 and TermSignal N, so the launcher reported success for a
crashed or killed command, masking failed compile/link/custom rules on
the dashboard and in instrumentation snippets.
Classify the child with the ordered triple SpawnResult, TermSignal,
ExitStatus, mapping a signal-killed child to a non-zero exit code.
Native Windows is unaffected: abnormal termination already arrives as a
non-zero exit code there.
Fixes: #27921
With instrumentation enabled, interrupting `cmake --install` (Ctrl+C)
terminated the process before its overall `cmakeInstall` envelope
snippet was written, orphaning the per-script `install` snippets.
Extend the `cmake --build` interrupt handling to the install site: wrap
the `cmakeInstall` command in `HandleInterrupt`, skip the post-install
hook, and re-raise so the exit status reflects the signal. Add
cooperative cancellation so the command unwinds -- serial-loop and
parallel `queueScripts` guards stop launching further scripts, and the
parallel failure aggregation is scoped to dispatched runners so
un-launched scripts are not counted as failed. Force a non-zero result
on interrupt (Windows cannot re-raise), and write the envelope
atomically so a second Ctrl+C cannot truncate it.
Issue: #27859
`cmake --install` did not propagate per-script failures into its
process exit code.
In parallel mode, cmInstallScriptHandler::Install spawned each install
script as a child process but never inspected the child exit status or
termination signal, and always returned 0. It now reads each child's
status after the event loop, prints the failing script's exit code or
signal, and returns non-zero if any script failed. A failed parallel
install also no longer writes the combined install_manifest.txt, so a
partial manifest is not mistaken for a complete install.
In serial mode, GetScripts() returns the top-level cmake_install.cmake
once per component and per configuration, so multiple scripts run only
when installing several components or configurations at once. The loop
overwrote its result on every iteration, so an earlier script that
failed via cmake_language(EXIT) was masked by a later one that
succeeded. The loop now stops at the first failure. This is a no-op
for a single component and configuration; it changes only installs of
multiple components or configurations, which now stop at the first
failed script and report it instead of attempting the rest.
Fixes: #27906
Add an --out-of-date option to ctest which runs only those tests with
recorded build dependencies whose timestamps are newer than the timestamp
at which the test last finished.
Fixes: #27614
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
Currently, target properties related to file sets are specific to file set
type (for example "SOURCE_SETS"). This raises some concerns:
1. For each new file set type, 6 new properties are created which need a lot
off documentation update
2. there is no "generic" way to discover file sets information
The new target properties (FILE_SET_TYPES, FILE_SETS_<TYPE>,
and INTERFACE_FILE_SETS_<TYPE>), in conjunction with the file sets
properties, enable a complete generic file sets information discovery.
Several $<LIST> doc references appeared as plain literal text: the bound
operand $<_0>, the configure-time list(TRANSFORM ... APPLY) command (the
TRANSFORM APPLY action title and prose), and the $<LIST:TRANSFORM,...,APPLY,body>
example in the $<_0> definition. Use the :genex: and :command: roles so they
hyperlink to their definitions, matching the sibling canned actions and the
rest of the manual.
Issue: #27892
ad0dfd51ba Tests: Enable some Linux cases on FreeBSD
144021a43b file(GET_RUNTIME_DEPENDENCIES): Implement command for FreeBSD
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12192
Extend the test_prep/<test> and test_prep/all build targets, generated
from add_test(BUILD_DEPENDS) when CMAKE_TEST_BUILD_DEPENDS is enabled, to
the Makefile generators. Previously only the Ninja and FASTBuild
generators provided them.
Resolve each test's dependencies in a shared layer so all command-line
generators consume one result. cmTestGenerator now filters target
dependencies to build-system targets and records, for each file
dependency, the single target that produces it as a primary
custom-command output (cmGlobalGenerator::FindOutputOwningTarget). The
Makefile generators emit phony rules in CMakeFiles/Makefile2 depending on
<target>.dir/all, with top-level forwarding rules. Sharing the
resolution also stops Ninja and FASTBuild from emitting a dead test_prep
edge for a non-buildable (e.g. INTERFACE) BUILD_DEPENDS target.
On the Makefile generators a file dependency that no single target
produces, and a test whose name contains ':', cannot be expressed as a
recursive-make rule and are reported with a warning and skipped.
Fixes: #27879
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