Commit Graph

6700 Commits

Author SHA1 Message Date
Brad King
c1565ed4e5 Merge topic 'fix-typos' into release-4.2
60273a364c Tests/RunCMake: fix version typo

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11325
2025-10-21 11:21:42 -04:00
Brad King
f0422c006c Merge topic 'pch-reuse-from-without-pch-warning' into release-4.2
cb6423703a PrecompileHeaders: downgrade `REUSE_FROM` without a PCH to a warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11318
2025-10-20 13:47:48 -04:00
Brad King
2813b08d69 Merge topic 'collect-genex-fix' into release-4.2
6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11322
2025-10-20 13:42:49 -04:00
AJIOB
60273a364c Tests/RunCMake: fix version typo 2025-10-19 07:55:13 +03:00
Ben Boeckel
cb6423703a PrecompileHeaders: downgrade REUSE_FROM without a PCH to a warning
Prior to f9bc615d (pchreuse: ban PCH reuse from targets which disable
PCH, 2025-06-15), using a target without PCH as a `REUSE_FROM` target
was not an error. Some projects had been doing this unknowingly.
Downgrade the fatal error into a warning so that such projects can at
least continue to build.

Fixes: #27316
2025-10-17 12:00:40 -04:00
Martin Duffy
6e637b1102 install(PACKAGE_INFO): Fix error when usage requirements contain certain genex
Since commit 13c7bb5b0c (cmGeneratorExpression: Update strip function to
collect parsed expressions, 2025-04-08, v4.1.0-rc1~361^2~1), the logic
to strip generator expressions would error if the stripped expressions
were being collected and an expression without a `:` was found inside an
expression with a `:`. This resulted in an error when exporting a target
that contained such a generator expression in its link libraries or
compile definitions.

Address the error by checking whether the latest `$<` proceeded the
latest `:`.
2025-10-17 11:34:43 -04:00
AJIOB
62b112ee25 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-16 17:42:12 +03:00
AJIOB
06ccd15457 Tests/RunCMake: Match xxx.cmake file name more precisely 2025-10-16 17:42:12 +03:00
Hanna Rusakovich
638cf8f194 Tests/RunCMake: Match CMakeLists.txt file name more precisely 2025-10-15 09:39:01 -04:00
Taylor Sasser
b209c41dfa export(TARGETS): Restore EXPORT_LINK_INTERFACE_LIBRARIES
Refactoring in commit 998495cb49 (cmExportCommand: Port to
cmSubcommandTable, 2025-07-15) accidentally removed support for the
`EXPORT_LINK_INTERFACE_LIBRARIES` argument.  Restore it with a test.

Fixes: #27302
2025-10-14 13:03:22 -04:00
Brad King
6b57a8435f Merge topic 'external-project-env-mod-lists' into release-4.2
9cb590b843 ExternalProject: Fix lists and empty commands with environment modification
2e0a8455b3 Tests: Match expected environment modification more completely
819c6177b8 Tests: Match expected environment modification more consistently
c555e10fd4 Tests: Use shorter paths in RunCMake.ExternalProject

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11272
2025-10-14 11:40:33 -04:00
Evan Wilde
9cb590b843 ExternalProject: Fix lists and empty commands with environment modification
Fix two bugs from commit e301cbffcc (ExternalProject: Set environment
variables, 2025-04-09):

* Do not flatten lists in command arguments when adding env mods.

* Remove empty `COMMAND`s without injecting corresponding env mods.

Fixes: #27125
Fixes: #27126
Co-authored-by: Brad King <brad.king@kitware.com>
2025-10-13 10:28:17 -04:00
Brad King
948b2fe31a CMP0204: Remove redundant cases from RunCMake.MsvcCharsetDefines
A single executable for each policy/charset combination is sufficient.
The behavior is the same across target types.

The "OLD" cases are not needed because "WARN" has the same behavior.

The `-D` cases are not needed because `target_compile_definitions`
strips the `-D` prefix before populating `COMPILE_DEFINITIONS`.
2025-10-12 11:11:41 -04:00
Brad King
2e0a8455b3 Tests: Match expected environment modification more completely 2025-10-12 10:33:52 -04:00
Brad King
819c6177b8 Tests: Match expected environment modification more consistently
Revert the regex change from commit 01147454e7 (FASTBuild: Add
generator, 2025-07-30) and revise the build output to match anyway.
The actual problem was that build and install steps are driven through
a nested `cmake --build`, and `fbuild` prefixes the first line of build
output.  Add an innocuous first line so we can match the intended lines
consistently across generators.
2025-10-12 10:33:14 -04:00
Brad King
8a135ea018 Tests: Teach MSVC ABI defs cases to tolerate NVCC CUDA arch warnings 2025-10-10 10:38:34 -04:00
Brad King
c555e10fd4 Tests: Use shorter paths in RunCMake.ExternalProject 2025-10-10 09:49:40 -04:00
Brad King
597e421ba3 Help: Remove incorrect Windows env var limitation from CTEST_PARALLEL_LEVEL
In commit 5de1e21659 (ctest: Allow passing -j without value to choose a
contextual default, 2024-03-06, v3.29.0-rc4~10^2) I misdiagnosed the
reason that the test could not set an empty environment variable on
Windows.  It is actually a limitation of `set(ENV{VAR})` inherited from
its implementation using `_wputenv`.  Process environment blocks can
contain empty environment variables.

Issue: #27285
2025-10-09 09:46:01 -04:00
Martin Duffy
f195c9ef2a genex: Add TARGET_INTERMEDIATE_DIR expression
Fixes: #27196
2025-10-09 08:07:20 -04:00
Brad King
81ee78a7e9 Merge topic 'update-kwsys'
77ea15b797 Tests: Add case covering `cmake -E env` with empty environment variable
209dfc51d3 Merge branch 'upstream-KWSys' into update-kwsys
92a7104600 KWSys 2025-10-08 (3bae03fe)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11288
2025-10-08 11:25:25 -04:00
Brad King
04c6c8fc09 Merge topic 'set-ENV-empty'
aa5711490f set: Explicitly unset empty environment variables on Windows
723a83d8cd set: Factor out helper to set environment variables
20761cf349 set: Add test cases for setting ENV{VAR} to empty
a878d1c490 Tests: Unset the PATH environment variable more explicitly where needed

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11290
2025-10-08 11:20:36 -04:00
Brad King
77ea15b797 Tests: Add case covering cmake -E env with empty environment variable
Issue: #27285
2025-10-08 11:17:20 -04:00
Brad King
20761cf349 set: Add test cases for setting ENV{VAR} to empty
The behavior differs by platform and if the variable is already set.
Encode existing behavior in tests to preserve it until intentionally
changed.

Issue: #27285
2025-10-07 11:32:53 -04:00
Brad King
a878d1c490 Tests: Unset the PATH environment variable more explicitly where needed
Previously we relied on setting an environment variable to empty to
unset it on Windows.
2025-10-07 11:32:48 -04:00
Craig Scott
f38f325e08 fileAPI: Add direct dependencies to target codemodel files
This adds the following new arrays, which together capture all direct
dependencies and interface dependencies of a target:

- linkLibraries
- interfaceLinkLibraries
- compileDependencies
- interfaceCompileDependencies
- objectDependencies
- orderDependencies

Fixes: #21995, #25213
2025-10-07 10:44:28 -04:00
Craig Scott
004d825f3e fileAPI: Add test coverage for interface direct and genex contexts 2025-10-07 10:44:28 -04:00
Craig Scott
53ed1e5893 fileAPI: Fix wrong linking relationship in symbolic library test
Commit 62a1d3e7f1 (FileAPI: Add symbolic property to targets, 2025-09-30)
contained an error in added test code where a wrong library was linked.
The naming of the targets involved make clear the intended linking
relationship, but nothing in the test was actually testing or relying on
that relationship so it went undetected.
2025-10-07 10:44:28 -04:00
Brad King
0181fb4cc5 Merge topic 'define-msvc-charset'
b554dead95 Tests: Cover CMP0203 and CMP0204 on all platforms
6874efb592 MSVC: Always define a character set
2cae68ecbe Source: Minor optimizations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11269
2025-10-07 10:43:08 -04:00
Alex Overchenko
b554dead95 Tests: Cover CMP0203 and CMP0204 on all platforms 2025-10-07 09:29:42 -04:00
AJIOB
6874efb592 MSVC: Always define a character set
When targeting the MSVC ABI, define `_MBCS` by default if the project
does not define `_SBCS` or `_UNICODE`.  Visual Studio has long defined
one of the three character set macros automatically.  For consistency,
define it when compiling for the MSVC ABI with other generators.
Add policy CMP0204 for compatibility.

Fixes: #27275
2025-10-07 09:29:32 -04:00
Brad King
0af6751e68 Merge topic 'ninja-trailing-newline-comment'
12a225d56d Ninja: handle trailing newlines in variable stanzas

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11286
2025-10-07 08:58:52 -04:00
Brad King
58880d6773 Merge topic 'ninja-trailing-newline-comment' into release-4.1
12a225d56d Ninja: handle trailing newlines in variable stanzas

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11286
2025-10-07 08:58:51 -04:00
Ben Boeckel
12a225d56d Ninja: handle trailing newlines in variable stanzas
When a variable ends with a newline, the Ninja generator escapes it as
expected with `$\n`. However, when writing it out, whitespace is
trimmed. This leaves a trailing `$` instead which consumes the newline
and masks the following stanza. In a custom command, this hides the
`restat = 1` setting.

Detect this case and restore the newline as necessary.

See: #25983
2025-10-06 09:54:15 -04:00
Brad King
8f166fa51e ci: Add jobs to perform coverage with BullseyeCoverage on Linux 2025-10-05 07:04:03 -04:00
Brad King
0d01bc72b8 Merge topic 'cps-symbolic-info'
62a1d3e7f1 FileAPI: Add symbolic property to targets
d92b6c3e20 CPS: Add Symbolic Components
03284e018f Help: Simplify file-api version information for "abstract" field

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11132
2025-10-03 11:24:50 -04:00
Brad King
caf01b88bc Merge topic 'instrumentation-target-content'
97adbc91fa instrumentation: Move target data into content files

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11251
2025-10-03 11:21:17 -04:00
Brad King
e9beb26909 Merge topic 'pkg-root-var'
1a16e4fc69 Merge branch 'backport-pkg-root-var' into pkg-root-var
87a661a916 find_package: Fix regression on `<PackageName>_ROOT` relative to CWD
fc059e1978 Merge branch 'backport-pkg-root-var' into pkg-root-var
ab0a44a0a0 find_package: Fix regression on `<PackageName>_ROOT` relative to CWD
d029b828b2 find_package: Avoid repeating search for lower-case .cps file
fc4d238d7a Tests: Match RunCMake.find_package-CPS version candidates more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11277
2025-10-03 11:12:07 -04:00
Robert Maynard
87a661a916 find_package: Fix regression on <PackageName>_ROOT relative to CWD
In commit 9d44a77454 (find_*: Explicitly normalize found paths as they
exist on disk, 2024-10-17, v4.0.0-rc1~597^2~1), we removed path
normalization from the internal `cmSearchPath::AddPathInternal` helper.
Most call sites were updated to normalize input paths first, but search
paths derived from `<PackageName>_ROOT` CMake variables are no longer
normalized.  Instead we normalize the path to the file found after
searching.

When `find_package` "config" mode considers a candidate CMake package
configuration file, normalize its path before loading the adjacent
package version file so that the latter is loaded by absolute path.
Otherwise `cmMakefile::ReadDependentFile` interprets a relative path
with respect to the current source directory rather than the current
working directory.

Fixes: #27279
2025-10-02 15:30:13 -04:00
Brad King
fc059e1978 Merge branch 'backport-pkg-root-var' into pkg-root-var 2025-10-02 15:28:03 -04:00
Brad King
fc4d238d7a Tests: Match RunCMake.find_package-CPS version candidates more precisely
Since commit 3e6466eb16 (find_package: Honor version requests when
finding CPS packages, 2025-02-12, v4.0.0-rc1~16^2) the test has relied
on `.*` to absorb capitalized paths on case-insensitive filesystems.
Match them explicitly.
2025-10-02 15:24:12 -04:00
Taylor Sasser
62a1d3e7f1 FileAPI: Add symbolic property to targets 2025-10-02 10:46:16 -04:00
Taylor Sasser
d92b6c3e20 CPS: Add Symbolic Components
Adds support for "symbolic" components, which represent feature-level
capabilities of a package that do not correspond to actual build targets.
These are modeled as pseudo-targets, using the INTERFACE type as a base,
and can be queried via:

  get_target_property(... <tgt> "SYMBOLIC")

This enables consumers to declare requirements on optional features
(e.g., SSL support) even when they do not map to concrete targets.

Fixes: #27187
2025-10-02 10:46:02 -04:00
Martin Duffy
97adbc91fa instrumentation: Move target data into content files
Create a single place to store target data to prevent duplication.
This moves `targetType` and `targetLabels` out of the snippet files
and into a target map in the `cmakeContent` file referenced by each
snippet.

Fixes: #27244
2025-10-02 09:28:20 -04:00
Brad King
bef873755b Merge topic 'define-windll'
83bbde5449 MSVC: Define _WINDLL consistently for shared libraries
206fcbb392 Tests/RunCMake/FileAPI: Fix whitespace in codemodel-v2 expectation data

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11194
2025-10-01 09:18:05 -04:00
Brad King
ec0cf06316 Merge topic 'instrumentation-always-record-build'
e730008d7e instrumentation: Record build snippets regardless of hooks

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11255
2025-09-30 10:05:02 -04:00
Brad King
85fb53f07a Merge topic 'test-gnu-as'
ab8b26b513 Tests: Fix regex matching path to GNU assembler tool

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11263
2025-09-30 10:03:38 -04:00
Brad King
7d551a5d6b Merge topic 'genex-transitive-link-libraries'
e0bbe79cea CMP0189: Restore support for linking `$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>`
cb69f750bf cmGeneratorTarget: Factor out helper to detect LINK_LIBRARIES evaluation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11262
2025-09-30 09:59:09 -04:00
Brad King
c6934e0928 Merge topic 'vs-sdk-style-platform-override'
4ebedf246d VS: Fix SLNs for DOTNET_SDK targets with VS_GLOBAL_PlatformTarget

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Steven Boswell <ulatekh@yahoo.com>
Merge-request: !11247
2025-09-30 09:57:09 -04:00
AJIOB
83bbde5449 MSVC: Define _WINDLL consistently for shared libraries
Visual Studio defines this automatically for `.dll` targets.
For consistency, define it when compiling for the MSVC ABI
with other generators.  Add policy CMP0203 for compatibility.

Fixes: #27253
2025-09-29 18:26:44 -04:00
AJIOB
206fcbb392 Tests/RunCMake/FileAPI: Fix whitespace in codemodel-v2 expectation data 2025-09-29 18:08:04 -04:00