Commit Graph

6381 Commits

Author SHA1 Message Date
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
Stepanov Igor 844d79916a cmake --build: Add support for driving Xcode workspaces
External tools may create a `.xcworkspace` directory next to the
`.xcodeproj` directory that CMake generates.  If a workspace exists,
drive the build through it instead.

Closes: #26958
Co-authored-by: Brad King <brad.king@kitware.com>
2025-06-10 11:08:04 -04:00
Brad King 7d5831424b Merge topic 'ctest-show-only-json-schema'
2e7bca5f05 ctest: Add JSON schema for --show-only=json-v1 output
fe1cd4e157 Help: Make docs for ctest --show-only=json-v1 reflect the implementation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10865
2025-06-10 10:00:58 -04:00
Brad King ed8513783c Merge topic 'instrumentation-fix'
e01d12c14f instrumentation: Prevent unnecessary query loading
f26f127183 instrumentation: Reuse single cmsys::SystemInformation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10863
2025-06-10 09:48:17 -04:00
Craig Scott 2e7bca5f05 ctest: Add JSON schema for --show-only=json-v1 output
Add schema validation to the existing test case for --show-only=json-v1 too.

Fixes: #26980
2025-06-10 07:12:31 +10:00
Ben Boeckel ee062ce4d0 cmFindCommon: test implicit configure log event reporting 2025-06-09 12:24:32 -04:00
Ben Boeckel 5aefc8b7b8 cmFindBase: let the debug state know if it has already been found
This avoids reporting a "not found" state for searches that had cached
results.
2025-06-09 12:24:31 -04:00
Ben Boeckel 928a74f684 cmFindCommon: always track configure log information
This does mean that debug state is always around, so instead gate the
non-configure log information behind a dedicated variable.
2025-06-09 12:24:31 -04:00
Brad King 4fa647a544 Tests: Match RunCMake.try_{compile,run} configure log more precisely 2025-06-09 12:18:22 -04:00
Martin Duffy e01d12c14f instrumentation: Prevent unnecessary query loading
Don't load queries from instrumentation directories when GetIsInTryCompile
or before ClearGeneratedQueries from previous configures has run.
2025-06-09 11:33:24 -04:00
Brad King 7fbd43c84c Merge topic 'cps-more-metadata'
da97747dac CPS: Support additional metadata
f224e131a5 CPS: Refactor metadata handling
7155903e53 cmExportPackageInfoGenerator: Fix style

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10856
2025-06-06 08:28:25 -04:00
Brad King 1824b771e9 Merge topic 'cpack-nuget-symbol-package'
e71396c8db CPack/NuGet: Enable the generation of NuGet symbol package(s)

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10852
2025-06-06 08:22:00 -04:00
Brad King 91690cac34 Merge topic 'msvc-link-machine'
92d6126450 MSVC: Move link -machine flag out of CMAKE_*_LINKER_FLAGS
bb8baacbcc MSVC: Factor out link -machine flag name
4c6c7f4d45 MSVC: Move link -subsystem flag handling near and -machine flag handling
f1a80a5581 CUDA: Drop unused link rule variable setting on Windows
a0732ce47f CMAKE_STATIC_LINKER_FLAGS: Fix terminology in cache entry help string
53aab8acd6 Tests: Generalize test name RunCMake.MSVC{Warning => Default}Flags

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10849
2025-06-06 08:19:54 -04:00
Jens Carl e71396c8db CPack/NuGet: Enable the generation of NuGet symbol package(s)
Enable the generation of NuGet symbol package(s) with the new variable
`CPACK_NUGET_SYMBOL_PACKAGE`. CPack generates then normal nuget package
(*.nupkg) and a symbol nuget package (*.snupkg). The new generate
package contains PDB files.

Fixes: #26976
2025-06-05 10:41:22 -04:00
Brad King 92d6126450 MSVC: Move link -machine flag out of CMAKE_*_LINKER_FLAGS
The `CMAKE_{EXE,SHARED,MODULE,STATIC}_LINKER_FLAGS` variables are
not language-specific, so multiple languages' toolchains may disagree
about if/how to pass the flag through a compiler driver to the linker.
Furthermore, carrying the flag in public-facing variables allows projects
or users to change it even though it is required.  Add policy CMP0197
to remove the flag from the public-facing variables and generate it
automatically instead:

* For command-line generators, add the `-machine:` flag to the
  linker and archiver rule variables.

* For Visual Studio generators, we do not need to explicitly add the
  link `-machine:` flag.  MSBuild automatically adds it, and the new
  behavior actually removes a duplicate we generated previously.

Issue: #21934
2025-06-05 09:16:54 -04:00
Brad King 727103ed9c Merge topic 'vs-Zc-defaults'
7db3dbddb2 VS: Suppress MSBuild default flags not specified by project or user

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10851
2025-06-04 11:22:26 -04:00
Brad King e25b99a4af Merge topic 'ninja-create_def-directory'
2ec61ed01d Ninja: Fix WINDOWS_EXPORT_ALL_SYMBOLS with PRE_LINK build event

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10844
2025-06-04 11:15:32 -04:00
Matthew Woehlke da97747dac CPS: Support additional metadata
Add support for specifying CPS's supplemental `description` and
`website` attributes. Add ability to inherit these from the `project()`,
similar to how version information can be inherited.
2025-06-03 16:50:46 -04:00
Vince Dupuis 2ec61ed01d Ninja: Fix WINDOWS_EXPORT_ALL_SYMBOLS with PRE_LINK build event
Previously the `__create_def` command could fail in cases where a
`PRE_LINK` custom command changes the working directory.

Fixes: #26973
2025-06-03 11:10:45 -04:00
Brad King 7db3dbddb2 VS: Suppress MSBuild default flags not specified by project or user
`Microsoft.Cl.Common.props` adds some `cl` flags by default, but for
CMake they may not match what's produced by command-line generators.
If the `-Zc:wchar_t`, `-Zc:forScope`, and/or `-Zc:inline` flags are
not specified by the project or user, suppress them.

Fixes: #26964
2025-06-02 14:59:38 -04:00
Matthew Woehlke ecf81c1bc1 CPS: Get metadata from project
Modify {export,install}(PACKAGE_INFO) commands to inherit version
information from the current project in situations where it seems
reasonable to do so. Add an option to explicitly request inheritance
from a specific project.

This leverages the recently added project(COMPAT_VERSION).
2025-06-02 10:31:36 -04:00