Commit Graph

12907 Commits

Author SHA1 Message Date
Richard 41be8cb44a FileAPI: Fix paths relative to root directory
We normalize directory paths to not end in `/`.  However, a root
directory path always ends in `/`.  Avoid removing the first character
after it.

Fixes: #27308
2025-10-22 09:25:39 -04:00
Brad King afa9e9d570 Merge topic 'usejava-modjar-improvements'
343ee5b9ee UseJava: add INCLUDE_MODULES argument to add_jar
b3365e7c57 UseJava: extract function to prepare the classpath arguments in add_jar

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11280
2025-10-15 09:12:24 -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
Javier Martín 343ee5b9ee UseJava: add INCLUDE_MODULES argument to add_jar
Arguments are added to the dependencies list, and to the "--module-path"
passed to javac, which is only generated for adequate JDK versions.
2025-10-14 18:23:21 +02:00
Brad King 5e7fa8d624 Merge topic 'patch-FindLua-version-51'
b4a08078d6 FindLua51: Use Lua51_VERSION result variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11306
2025-10-14 11:46:27 -04:00
Brad King 6843f4b62a Merge topic 'patch-FindLua-version-51' into release-4.2
b4a08078d6 FindLua51: Use Lua51_VERSION result variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11306
2025-10-14 11:46:25 -04:00
Brad King 623e1b6c62 Merge topic 'external-project-env-mod-lists'
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:40 -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
Peter Kokot b4a08078d6 FindLua51: Use Lua51_VERSION result variable
If using both FindLua and FindLua51 modules, the FindLua51 and Lua 5.2
or newer is found, FindLua51 module can set the Lua_VERSION variable to
empty value. Instead, the Lua51_VERSION can be used to bypass this
issue.

Issue: #27088
2025-10-13 12:10:24 -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
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 ceecafd7d5 Merge topic 'ci-gcov'
f7b0ddbe92 gitlab-ci: add a series of jobs to perform coverage
cedd32892e ci: support setting a different test timeout for CI
da4a1ec2ff gitlab-ci: add support for running gcov-based coverage
61aed5e5f2 CTestCustom: ignore coverage results from coverage tests
7191d72acd Tests/EnforceConfig: clear the `CMAKE_BUILD_TYPE` environment variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11245
2025-10-01 11:39:29 -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 22dab5c52b Merge topic 'date-parse-2038'
6b5877a176 libarchive: Backport "parse_date: handle dates in 2038 and beyond"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11260
2025-10-01 08:36:44 -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
Brad King 6b5877a176 libarchive: Backport "parse_date: handle dates in 2038 and beyond"
Backport libarchive commit `2d987e725f` (parse_date: handle dates in
2038 and beyond if time_t is big enough, 2025-09-26).

Add a cmake-specific test case.

Fixes: #27263
2025-09-30 09:36:08 -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