Commit Graph

71286 Commits

Author SHA1 Message Date
Brad King
efe6ffc2f5 Merge topic 'backport-4.0-cross-compile-macos' into release-4.1
61d0bdf6b7 macOS: Avoid relying on sw_vers when cross-compiling from another OS
d9d65ab54f macOS: Remove outdated condition for CMAKE_OSX_DEPLOYMENT_TARGET

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11340
2025-10-22 19:09:36 -04:00
Brad King
61d0bdf6b7 macOS: Avoid relying on sw_vers when cross-compiling from another OS
We have a few code paths needed only to support builds hosted on
macOS 10.4.  Update the conditions to work when cross-compiling
to macOS from another platform.

This backports commit eb8facd396 (macOS: Avoid relying on sw_vers
when cross-compiling from another OS, 2025-04-28, v4.1.0-rc1~260^2)
to CMake 4.0.

Fixes: #26814
2025-10-22 17:26:36 -04:00
Brad King
d9d65ab54f macOS: Remove outdated condition for CMAKE_OSX_DEPLOYMENT_TARGET
Revert commit 2853326e7a (BUG: Only set CMAKE_OSX_DEPLOYMENT_TARGET on
Mac OSX 10.4 or later, 2009-01-27, v2.8.0~1169).  AFAIK no one is using
macOS versions older than 10.4 anymore.

This backports commit 476b2a386f (macOS: Remove outdated condition
for CMAKE_OSX_DEPLOYMENT_TARGET, 2025-04-28, v4.1.0-rc1~260^2~1)
to CMake 4.0.
2025-10-22 17:26:31 -04:00
Brad King
458ef4ad11 Merge branch 'release-4.0' into release-4.1 2025-10-21 11:03:29 -04:00
Brad King
3a953fcfff Merge branch 'release-3.31' into release-4.0 2025-10-21 11:03:18 -04:00
Brad King
a606bc4a7f Merge topic 'backport-3.31-ios-compiler-inspection' into release-4.1
636d3a7a2f Apple: Backport "Enable linking during iOS toolchain inspection" to 3.31

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11333
2025-10-21 11:03:01 -04:00
Brad King
42b3b74bde Merge topic 'backport-3.31-ios-compiler-inspection' into release-4.0
636d3a7a2f Apple: Backport "Enable linking during iOS toolchain inspection" to 3.31

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11333
2025-10-21 11:02:39 -04:00
Brad King
d83b2e8fe0 Merge topic 'backport-3.31-ios-compiler-inspection' into release-3.31
636d3a7a2f Apple: Backport "Enable linking during iOS toolchain inspection" to 3.31

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11333
2025-10-21 11:01:39 -04:00
Brad King
636d3a7a2f Apple: Backport "Enable linking during iOS toolchain inspection" to 3.31
Backport commit 79a83ddb08 (Apple: Enable linking during
iOS/tvOS/visionOS/watchOS toolchain inspection, 2024-11-14,
v4.0.0-rc1~471^2) to 3.31.

Since commit 11da882a12 (Apple: Introduce separate system name for iOS,
tvOS, and watchOS, 2018-01-15, v3.14.0-rc1~14^2~1) our toolchain
inspection steps, like ABI detection, tell `try_compile` to use a
`STATIC_LIBRARY` instead of an `EXECUTABLE`.  This was needed at the
time to avoid codesign requirements.  However, commit d3a64c4e3f (Xcode:
Explicitly turn off signing in try_compile projects, 2020-07-16,
v3.19.0-rc1~483^2) introduced a more general solution to that problem.
Restore linking during toolchain inspection so that we can detect and
identify the linker.

Suggested-by: Marc Chevrier <marc.chevrier@gmail.com>
Fixes: #26443
2025-10-21 09:22:41 -04:00
Brad King
a2ebda45e2 Merge topic 'collect-genex-fix' into release-4.1
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:41:30 -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
Brad King
ae2cdad16c Merge branch 'release-4.0' into release-4.1 2025-10-07 16:47:47 -04:00
Brad King
d4837302fe Merge branch 'release-3.31' into release-4.0 2025-10-07 16:45:24 -04:00
Brad King
892b0de5d4 Merge topic 'backport-ci-xcode-26' into release-3.31
9d302ecd47 ci: update macOS jobs to use Xcode 26.0 in CMake 3.31 branch
f6f1c5ca1f Tests: Teach RunCMake to ignore Xcode an IDERunDestination warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11292
2025-10-07 16:44:28 -04:00
Brad King
9d302ecd47 ci: update macOS jobs to use Xcode 26.0 in CMake 3.31 branch 2025-10-07 14:14:26 -04:00
Brad King
f6f1c5ca1f Tests: Teach RunCMake to ignore Xcode an IDERunDestination warning
On some Xcode versions, `xcodebuild` may warn:

    ... xcodebuild[...] IDERunDestination: ...

Teach RunCMake to drop such incidental lines before matching against
expected output.

Backport commit edaa6ed06a (Tests: Teach RunCMake to ignore Xcode an
IDERunDestination warning, 2025-09-19, v4.1.2~9^2~1) to CMake 3.31.
2025-10-07 14:12:53 -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
a2f4f74ed3 Merge branch 'release-4.0' into release-4.1 2025-10-03 11:13:58 -04:00
Brad King
9cd9d787ea Merge topic 'pkg-root-var' into release-4.1
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:06 -04:00
Brad King
9355a194ca Merge topic 'backport-pkg-root-var' into release-4.0
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:10:18 -04:00
Brad King
1a16e4fc69 Merge branch 'backport-pkg-root-var' into pkg-root-var
Use the `-s ours` strategy because we already made equivalent changes.
2025-10-02 15:31:06 -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
Robert Maynard
ab0a44a0a0 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:24:47 -04:00
Brad King
d029b828b2 find_package: Avoid repeating search for lower-case .cps file 2025-10-02 15:24:47 -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
Brad King
9cab1062e4 Merge branch 'release-4.0' into release-4.1 2025-10-02 13:57:11 -04:00
Brad King
9f7179793b Merge topic 'build-graph-opt-docs' into release-4.1
fac5e622b7 Help/OPTIMIZE_DEPENDENCIES: xref with CMP0154 documentation
03f5ffa2ca Help/OPTIMIZE_DEPENDENCIES: move period outside of parenthetical

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11275
2025-10-02 13:56:25 -04:00
Brad King
375307f4d7 Merge topic 'build-graph-opt-docs' into release-4.0
fac5e622b7 Help/OPTIMIZE_DEPENDENCIES: xref with CMP0154 documentation
03f5ffa2ca Help/OPTIMIZE_DEPENDENCIES: move period outside of parenthetical

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11275
2025-10-02 13:55:34 -04:00
Ben Boeckel
fac5e622b7 Help/OPTIMIZE_DEPENDENCIES: xref with CMP0154 documentation
Closes: #27250
2025-09-30 22:59:04 -04:00
Ben Boeckel
03f5ffa2ca Help/OPTIMIZE_DEPENDENCIES: move period outside of parenthetical
The preceding sentence needs a terminator.
2025-09-30 22:58:34 -04:00
Brad King
11f3f34077 CMake 4.1.2 v4.1.2 2025-09-30 10:48:33 -04:00
Brad King
aec52661a3 Merge topic 'genex-transitive-link-libraries' into release-4.1
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:07 -04:00
Brad King
e0bbe79cea CMP0189: Restore support for linking $<TARGET_PROPERTY:tgt,LINK_LIBRARIES>
In general we disallow references to transitive target properties, such
as `COMPILE_DEFINITIONS`, in `[INTERFACE_]LINK_LIBRARIES` properties,
because the latter establish the transitivity itself.  Prior to CMP0189,
the `[INTERFACE_]LINK_LIBRARIES` properties were not themselves transitive
in `$<TARGET_PROPERTY>` expressions, so existing projects have code like

    target_link_libraries(foo PRIVATE "$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>")

Policy CMP0189's NEW behavior, introduced by commit b3da9c6d60 (GenEx:
Evaluate LINK_LIBRARIES target properties transitively, 2025-02-24,
v4.1.0-rc1~731^2), makes `$<TARGET_PROPERTY:tgt,LINK_LIBRARIES>`
transitive, causing the above to be rejected.  Since evaluation of a
target's link libraries can already encounter and handle other targets'
link libraries, allow it in this case.

Fixes: #27265
2025-09-29 10:51:01 -04:00
Brad King
cb69f750bf cmGeneratorTarget: Factor out helper to detect LINK_LIBRARIES evaluation 2025-09-26 17:41:41 -04:00
Brad King
24ede8c516 Merge branch 'release-4.0' into release-4.1 2025-09-25 09:01:35 -04:00
Brad King
c4095eaf86 Merge branch 'release-3.31' into release-4.0 2025-09-25 09:01:23 -04:00
Brad King
7ef733450c Merge topic 'bootstrap-devirtualization' into release-4.1
ea04e19daf bootstrap: Fix compilation with gcc 16 devirtualization

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11243
2025-09-25 09:00:39 -04:00
Brad King
21bc83344c Merge topic 'bootstrap-devirtualization' into release-4.0
ea04e19daf bootstrap: Fix compilation with gcc 16 devirtualization

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11243
2025-09-25 08:58:51 -04:00
Brad King
2303c04c20 Merge topic 'bootstrap-devirtualization' into release-3.31
ea04e19daf bootstrap: Fix compilation with gcc 16 devirtualization

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11243
2025-09-25 08:57:57 -04:00
Brad King
ea04e19daf bootstrap: Fix compilation with gcc 16 devirtualization
Avoid including a header for a subclass whose implementation is not
compiled during bootstrap.

Fixes: #27256
2025-09-24 17:20:35 -04:00
Brad King
98961a7dd4 Merge branch 'release-4.0' into release-4.1 2025-09-24 14:07:54 -04:00
Brad King
a2faa7af28 Merge branch 'release-3.31' into release-4.0 2025-09-24 14:07:42 -04:00
Brad King
622044ce33 CMake 3.31.9 v3.31.9 2025-09-24 13:24:34 -04:00
Brad King
e46097dbfa Merge topic 'file-GENERATE-CMP0189' into release-4.1
deb7b4b658 file(GENERATE): Record CMP0189 at each call site
9b862e7013 cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11234
2025-09-24 08:45:12 -04:00
Brad King
deb7b4b658 file(GENERATE): Record CMP0189 at each call site
Policy CMP0189, introduced by commit b3da9c6d60 (GenEx: Evaluate
LINK_LIBRARIES target properties transitively, 2025-02-24,
v4.1.0-rc1~731^2), takes effect at generation time, and so uses the
policy value as of the end of each directory.  However, some projects
may rely on `file(GENERATE)` with the policy's OLD behavior in order
to extract targets' *direct* dependencies from `LINK_LIBRARIES`.
Pending a first-class solution to that problem, make it easier for
projects to port to the policy's NEW behavior in general while
retaining the OLD behavior in an isolated context.

Fixes: #27220
2025-09-23 11:30:22 -04:00
Brad King
9b862e7013 cmGeneratorTarget: Pass genex evaluation context to IsTransitiveProperty 2025-09-23 10:57:22 -04:00
Brad King
6201ff1864 Merge topic 'doc-CMP0189' into release-4.1
e8d779c935 Help: Document when policy CMP0189 takes effect

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11230
2025-09-23 09:14:14 -04:00
Brad King
e8d779c935 Help: Document when policy CMP0189 takes effect
This was left out of commit b3da9c6d60 (GenEx: Evaluate LINK_LIBRARIES
target properties transitively, 2025-02-24, v4.1.0-rc1~731^2).

Issue: #27220
2025-09-22 15:21:05 -04:00