Commit Graph

6401 Commits

Author SHA1 Message Date
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
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
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 72fcfe5b36 Merge topic 'ci-xcode-26' into release-4.1
965a12cb8a ci: update macOS jobs to use Xcode 26.0
edaa6ed06a Tests: Teach RunCMake to ignore Xcode an IDERunDestination warning

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11209
2025-09-21 18:56:48 -04:00
Brad King edaa6ed06a 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.
2025-09-19 08:19:34 -04:00
Brad King 3b85cc1a8e Tests: Extend RunCMake.ParseImplicitLinkInfo for LFortran 0.55.0 2025-09-15 20:34:16 -04:00
Cristian Le 2e88a3efc2 GNUInstallDirs: Fix regression on -DCMAKE_INSTALL_<dir>=<default> in /usr
Fix commit 9789f7d05e (GNUInstallDirs: Add internal helper to compute
specific defaults, 2025-03-28, v4.1.0-rc1~384^2~3) to avoid updating
explicitly-specified cache entries on the first run.  Do not reset the
default value until at least the second run, during which we have
`_GNUInstallDirs_LAST_CMAKE_INSTALL_PREFIX` already defined.

Fixes: #27211
2025-09-10 16:03:43 -04:00
Brad King 87d95b2222 ASM: Restore CMAKE_ASM_COMPILER_ARCHITECTURE_ID persistence
Refactoring in commit 019f0f8b32 (ARCHITECTURE_ID: Save persistently
even if empty, 2025-03-13, v4.1.0-rc1~499^2~1) accidentally dropped
part of the variable name in `CMakeASMCompiler.cmake`.

Reported-by: Felipe Torrezan <felipe.torrezan@iar.com>
2025-09-08 10:38:30 -04:00
Marc Chevrier c504b1c638 FindPython: Ensure correct handling of Python_FIND_ABI variable
Fixes: #27192
2025-09-04 15:06:57 +02:00
Brad King a4dd4f3dad Merge topic 'ninja-custom-command-comment-syntax' into release-4.1
1bf48e34f4 Ninja: escape special characters in custom command comments

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11136
2025-09-03 10:20:15 -04:00
Ben Boeckel 1bf48e34f4 Ninja: escape special characters in custom command comments
Considerations of Ninja's control sequences was not considered in
30fb5b1b22 (Ninja: add COMMENT to build statement descriptions,
2024-05-01) via !9484. Escape both newlines and dollar signs.

Fixes: #27181
2025-09-02 15:33:20 -04:00
Vito Gamberini aa16b8eb9a project: Revert changes to VERSION handling
In c4d12d7d we changed how the project command handles various variables
and made the behavior consistent across all variables controlled by
the project command. The conditions under which project() modifies the
various VERSION variables are non-intuitive, but can be observed as
side-effects.

Because this behavior is observable, it requires a policy to be changed.
This commit reverts to the previous behavior until a policy is added
and adds a test for that behavior.

Fixes: #27142
2025-09-02 00:35:24 -04:00
Brad King 0ef525208c Merge topic 'ctest-T-test-timeout' into release-4.1
9dc3edbba8 ctest: Restore default test timeout for command-line `-T Test` step
8745e6308e ctest: Restore default of no time limit for command-line `-T Test` step

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11094
2025-08-20 10:01:00 -04:00
Brad King 9dc3edbba8 ctest: Restore default test timeout for command-line -T Test step
In commit 774fcbe49c (CTest: Base command line mode on top of scripting
commands, 2024-10-05, v4.0.0-rc1~653^2) the implementation of this step
was converted to use `ctest_test` internally.  That command has its own
default test timeout of 600s if the ctest "TimeOut" configuration value
is not set.  If "TimeOut" is not set then default it to our previous
command-line mode default test timeout.

Fixes: #27139
2025-08-18 14:30:56 -04:00
Brad King 4445478ef7 Merge topic 'pkgc-import-system-fix' into release-4.1
d5f6cf5ba8 PkgC: Only remove system paths which are exact matches
93f77d8183 PkgC: Allow system paths during IMPORT, POPULATE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11078
2025-08-14 09:22:47 -04:00
Martin Duffy 8227028e49 string(GENEX_STRIP): Fix regression on nested generator expressions
Since commit 13c7bb5b0c (cmGeneratorExpression: Update strip function to
collect parsed expressions, 2025-04-08), the logic to strip generator
expressions from a string made incorrect assumptions about the contents of
generator expressions, leading certain cases to be stripped incorrectly.

Clean up the logic and fix broken behavior, and add test coverage with
`string(GENEX_STRIP)`.

Fixes: #27133
2025-08-13 15:52:16 -04:00
Vito Gamberini d5f6cf5ba8 PkgC: Only remove system paths which are exact matches 2025-08-13 12:59:00 -04:00
Vito Gamberini 93f77d8183 PkgC: Allow system paths during IMPORT, POPULATE
Fixes: #27138
2025-08-13 11:57:09 -04:00
Brad King 21e99dbf49 install(DIRECTORY): Revert "Add EXCLUDE_EMPTY_DIRECTORIES option"
Revert commit b70ef48b27 (install(DIRECTORY): Add
EXCLUDE_EMPTY_DIRECTORIES option, 2025-04-20, v4.1.0-rc1~212^2).
The implementation had at least two problems:

* It did not exclude the top-level directory if empty.
* It did not exclude non-empty directories whose contents are
  all filtered out.

Revert the feature pending a revised implementation.

Issue: #19189
Closes: #27092
2025-07-28 14:21:09 -04:00
Brad King a760a74abf Tests: Optionally skip tests requiring 64-bit time_t
On some platforms, `time_t` is always 32-bit.  Add an explicit option
to skip tests that require 64-bit `time_t`.
2025-07-16 14:28:43 -04:00
Brad King 265c676445 Merge topic 'windows-kernel-mode-driver' into release-4.1
2f5dce1b40 cmExperimental: remove the flag for Windows Kernel Mode Driver support

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10937
2025-07-10 10:30:23 -04:00
Vito Gamberini ea6404b9c4 FileAPI: Ignore unresolved FileSet generators
Fixes: #27054
2025-07-09 10:08:47 -04:00
Brad King 2f5dce1b40 cmExperimental: remove the flag for Windows Kernel Mode Driver support
Enable setting `CMAKE_SYSTEM_NAME` to `WindowsKernelModeDriver` without
an experimental gate.
2025-07-09 09:54:45 -04:00
Vito Gamberini a38e594340 project: fix keyword argument as project name
Fixes: #27051
2025-07-08 18:00:00 -04:00
Brad King 567ce02d48 Merge topic 'GNUInstallDirs-cached-default' into release-4.1
5071c93a78 GNUInstallDirs: Fix regression on -DCMAKE_INSTALL_<dir>=<default>

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Acked-by: Cristian Le <github@lecris.me>
Merge-request: !10921
2025-07-03 13:01:25 -04:00
Brad King 5071c93a78 GNUInstallDirs: Fix regression on -DCMAKE_INSTALL_<dir>=<default>
In commit 42dfcbf1a5 (GNUInstallDirs: Refactor LIBDIR default
calculation, 2025-03-27, v4.1.0-rc1~384^2~2) we introduced the
`_GNUInstallDirs_LIBDIR_get_default` helper and exercised code from
commit 9789f7d05e (GNUInstallDirs: Add internal helper to compute
specific defaults, 2025-03-28, v4.1.0-rc1~384^2~3) for the first time.
Fix the latter's code to update the `CMAKE_INSTALL_<dir>` cache entry
without triggering conversion of a relative path to an absolute path.

Fixes: #27027
2025-07-02 09:14:56 -04:00
Vito Gamberini 58d9950842 CPS: Fix empty configuration field on noconfig builds
Fixes: #27044
2025-07-01 17:01:13 -04:00
Brad King 1b9e8f833f Linux: Compile with 64-bit time_t even on 32-bit architectures
Extend commit 5b10f96793 (Linux: Compile with _FILE_OFFSET_BITS=64 on
32-bit Linux, 2020-09-23, v3.19.0-rc1~112^2) to cover `time_t` too,
by compiling with `_TIME_BITS=64`.
2025-06-26 09:23:33 -04:00
Brad King 9c3ce7852f Merge topic 'normalize-toolchain-file' into release-4.1
c393300e2b cmake: Restore acceptance of -DCMAKE_TOOLCHAIN_FILE=//... on non-Windows
cf0f46ed85 Tests/RunCMake/CommandLine: Simplify --toolchain cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10901
2025-06-24 10:42:34 -04:00
Brad King c393300e2b cmake: Restore acceptance of -DCMAKE_TOOLCHAIN_FILE=//... on non-Windows
POSIX specifies that two leading slashes have implementation-defined
interpretation, so CMake 3.31 and below did not normalize away leading
double slashes.  However, most implementations simply treat a leading
`//` as just `/`, so CMake 4.0 now normalizes them away when they do not
correspond to a network path on Windows.

This change exposed that we were not normalizing `CMAKE_TOOLCHAIN_FILE`
before passing its value to `include()` the first time if it was not
passed with the `FILEPATH` or `PATH` cache entry type.  Fix that.

Fixes: #27010
2025-06-23 10:37:59 -04:00
Brad King cf0f46ed85 Tests/RunCMake/CommandLine: Simplify --toolchain cases 2025-06-23 10:23:11 -04:00
AJIOB 99d09ec45a VS: Suppress MSBuild default link flags not specified by project or user
MSBuild adds some `link` flags by default, but for CMake they may not
match what's produced by command-line generators.  If these flags are
not specified by the project or user, suppress them.

Fixes: #27004
2025-06-17 14:12:43 -04:00
Brad King 68eb6fb683 Merge topic 'xcode-build-workspace'
26869fb4ba cmake --build: Fix building multiple targets in Xcode workspace

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10875
2025-06-17 09:11:48 -04:00
Brad King e227c5a9a4 Merge topic 'fix-package-metadata-arg-parsing'
bb1e00b92c cmPackageInfoArguments: Validate new arguments
0fcea1b15e cmPackageInfoArguments: Simplify argument checking

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10885
2025-06-17 09:08:05 -04:00
Stepanov Igor 26869fb4ba cmake --build: Fix building multiple targets in Xcode workspace
Extend commit 844d79916a (cmake --build: Add support for driving Xcode
workspaces, 2025-06-02) to support multiple `--target` arguments.
`xcodebuild -scheme` cannot be repeated in a single call, so call it
multiple times instead.

Issue: #26958

Co-Authored-By: Craig Scott <craig.scott@crascit.com>
2025-06-14 16:53:25 +10:00
Matthew Woehlke bb1e00b92c cmPackageInfoArguments: Validate new arguments
Add validation of recently added `DESCRIPTION` and `HOMEPAGE_URL`
arguments to `export`/`install` commands.
2025-06-13 14:30:46 -04:00
Brad King eafb776fdb Tests/RunCMake/if: Suppress FilePermissions failure on CYGWIN
After a recent update, CYGWIN no longer seems to recognize execute
permission without read permission.
2025-06-13 10:36:35 -04:00
Brad King a098f6b008 Tests/RunCMake/if: Fix FilePermissions failure message typo 2025-06-13 10:35:04 -04:00
Vito Gamberini d71b59a4f7 install(TARGETS): Don't ignore non-extant file sets
When installing FILE_SETs, it is possible the FILE_SET has not yet been
created with target_sources(FILE_SET). Instead of ignoring this
situation, we need to track the installed FILE_SET names and their
possible install destinations.

At generation time we resolve the names and destinations concretely. If
a FILE_SET wasn't provided or isn't an INTERFACE, we silently bail out.

Fixes: #26697
2025-06-12 16:58:11 -04:00
Brad King 7dba72f9d1 Merge topic 'suppress-implicit-find-events'
c42d82d569 find_*: support suppressing implicit transition events
64f429cc4f Help/dev: add release note for implicit configure log find events
4cd83339f1 cmFindCommon: fix comment after renaming the `FullDebugMode` member

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10874
2025-06-12 09:49:16 -04:00
Ben Boeckel c42d82d569 find_*: support suppressing implicit transition events
When projects explicitly unset variables, the transition detection can
end up reporting events when they are not desired.

See: #24833
2025-06-11 20:09:32 +02:00
Jens Carl 7ce9556acf CPack/NuGet: Set correct version for test case CPack NuGet Lib 2025-06-11 10:11:34 -07:00
Brad King b59925a842 Merge topic 'xcode-build-workspace'
844d79916a cmake --build: Add support for driving Xcode workspaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10855
2025-06-11 10:26:54 -04:00
Brad King 92d13b9117 Merge topic 'always-set-project-COMPAT_VERSION'
04dadd0138 Tests: Ensure project() clears unspecified properties
6171e2da90 project: Always set COMPAT_VERSION variables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10871
2025-06-11 10:09:15 -04:00
Brad King afed566a0a Merge topic 'find-events-without-debugging'
0e53a67a7b cmFindPackage: fix over-reporting
8b3fc9578a cmFindPackageCommand: report found files to debugging infra
ee062ce4d0 cmFindCommon: test implicit configure log event reporting
a90598f17c cmFindCommon: support suppressing implicit event logging
5aefc8b7b8 cmFindBase: let the debug state know if it has already been found
928a74f684 cmFindCommon: always track configure log information
4fa647a544 Tests: Match RunCMake.try_{compile,run} configure log more precisely

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10783
2025-06-11 09:56:50 -04:00
Matthew Woehlke 04dadd0138 Tests: Ensure project() clears unspecified properties
Add a unit test to ensure that various project-related variables are set
to empty when values are not provided in the project() call.
2025-06-10 15:07:29 -04:00
Ben Boeckel 0e53a67a7b cmFindPackage: fix over-reporting
Both track when a `_DIR` variable is already defined and suppress
implicit event reporting when a mode that has no reliable method for
such detection.
2025-06-10 20:01:12 +02:00