Iterating a JSON array with GET re-parses the entire string on every
call, so walking N elements is O(N^2). ARRAY_SPLIT parses the array
once and returns its elements as a CMake list, letting each element be
queried individually in linear total time.
Each element is re-serialized as compact JSON and encoded to survive
CMake list parsing: '[' and ']' inside strings are emitted as \u005B
and \u005D, and ';' is escaped as '\;'. Every element therefore stays
valid, re-queryable JSON.
Fixes: #27985
Propagates variables set in enable_language() logic up variable scopes
so that the language can be used by targets in the ancestor directories.
Works through block() and function() scopes as well. The
add_subdirectory() call can be thought of as the effective call site for
enabling the language. The same holds for endblock() and the actual
function call.
Adds a policy CMP0220 to control this behavior. As the language is
"enabled" at each ancestor scope, the policy is checked. If OLD, the
language is not enabled at this scope and the ones above.
Closes: #27881#27508#27389
Related: #26751#27564
The '--target' completion parsed 'cmake --build --target help'
with a sed pattern whose leading '...' matched any three
characters, so the header line yielded a bogus 'following'
candidate. Anchor the pattern to literal dots.
Also note in the user-interaction guide that 'make' target
tab-completion is provided by the external bash-completion
package, which may hide the plain '<target>' name when a
'<target>/fast' variant exists, and recommend
'cmake --build --target' completion instead.
Fixes: #27873
Tweak how we reference preset macros so that references also carry
'literal' markup. While this provides a modest improvement to HTML
rendered help, it primarily serves to apply 'literal' formatting
consistently for TTY output (`cmake --help-presets`).
Introduce `CMD_STRICT` to act as a parent for warnings about allowed but
disrecommended usage. Introduce a warning that discourages use of
non-target directives (which modify the build environment for the entire
[sub]tree). Add notes to the official documentation recommending use of
target-specific alternatives. This has been accepted wisdom for quite
some time, but only some of the affected commands made any mention of
this in the documentation.
File sets have evolved to be more ubiquitous throughout a CMake build,
outside the scope of simply the target_sources command. Move general
information to the `cmake-buildsystem(7)` manual and keep only
reference information specific to the syntax of target_sources in its
command page. Sprinkle some more cross-references to the new location.
Fixes: #27900
Suggested-By: Marc Chevrier <marc.chevrier@gmail.com>
The ctest(1) command line allows repeating -L/-LE to form an AND
filter over test labels, but the ctest_test() and ctest_memcheck()
scripting commands accepted only a single INCLUDE_LABEL/EXCLUDE_LABEL
value, so a dashboard script could not express that filter.
The label-matching engine already stores the include/exclude
expressions as vectors and applies them with AND semantics; only the
command binding was single-value. Change both keywords to multi-value
(NonEmpty<vector<string>>) and hand the collected list straight to the
engine. ctest_memcheck() gains the same behavior for free, since it
inherits the option set.
Fixes : #27497
The TEST_INCLUDE_FILE(S) directory properties were written verbatim into
CTestTestfile.cmake, so a $<CONFIG>-parameterized include path could not
select a per-configuration script and failed at ctest time.
Evaluate generator expressions per include entry in
cmLocalGenerator::GenerateTestFiles():
* Entries without a generator expression are emitted unchanged.
* On single-config generators a genex entry is evaluated once and
emitted as one unconditional include.
* On multi-config generators it is evaluated for every configuration;
a config-independent result collapses to one unconditional include,
otherwise each non-empty per-config result is guarded by a
CTEST_CONFIGURATION_TYPE branch, mirroring add_test(). An entry that
evaluates to empty adds no include.
Promote cmScriptGenerator::CreateConfigTest to a public static helper so
the include guards reuse the exact add_test() config-test encoding; the
instance overloads now delegate to it. Evaluated results are quoted via
cmScriptGenerator::Quote, while plain entries keep their raw
serialization.
Fixes: #27941
Move documentation added by commit 45623dd5f6 (cmake_language: Add
PRINT_TARGETS operation, 2026-06-26) to the end of the signature list
to make room for more print signatures.
Issue: #27513
They don't support setting compiler via this variable, they use the
toolsets, so you could switch the compiler by choosing another toolset.
Closes: #21644