Commit Graph

11761 Commits

Author SHA1 Message Date
Brad King
1e0cd39460 Merge topic 'link-warning-as-error'
7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
656267c871 COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9984
2024-11-13 09:24:36 -05:00
Brad King
fc5cdacb11 Merge topic 'gtest-discover-flush-duplicates'
007d7ea648 GoogleTest: Avoid extra call to set DISABLED test property in discovery
9a24c1e802 GoogleTest: Clear script content buffer on flush and flush less often

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9982
2024-11-13 09:14:38 -05:00
Craig Scott
9a24c1e802 GoogleTest: Clear script content buffer on flush and flush less often
There's no need to check if flushing is needed after every command
is added to the variable holding the script content. It is enough to only
check once per test name. This simplifies the flushing logic, removing
the need for a separate flush_script() command. Previously, we were
not clearing the flushed script contents in all cases, but this is now
rigorously enforced at the one location where flushing is performed.

Also simplify the flushing of the list of test names, since that too doesn't
need a separate command. It is simpler and safer to handle that
directly inline where the one call to flush_tests_buffer() was
previously being made.

Fixes: #26431
2024-11-12 10:22:21 -05:00
Marc Chevrier
7907c83175 Link step: Add LINK_WARNING_AS_ERROR target property
Add a way to specify, in a portable way, to raise an error for any
warning during the link step. For that purpose, define:
* CMAKE_LINK_WARNING_AS_ERROR variable
* LINK_WARNING_AS_ERROR target property

Fixes: #25343
2024-11-12 15:11:53 +01:00
Brad King
ed7910b642 Merge topic 'refactor-documentation-formatter'
dd0142e6d0 cmDocumentationFormatter: Refactor the `PrintFormatted()` method
ef88ec41f3 testDocumentationFormatter: Add some more test cases

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9979
2024-11-08 11:54:19 -05:00
Brad King
b89610b5fa Merge topic 'apple-compiler-selection'
7b19531291 macOS: Do not pass any SDK/-isysroot to compilers by default
3b8b70fe72 macOS: Simplify logic converting CMAKE_OSX_SYSROOT to a path
c55c113076 macOS: Revert finding tools inside Xcode that are not in the PATH
77fcee9204 macOS: Revert "Resolve compiler in /usr/bin to that reported by Xcode xcrun"
9eb530842c Tests/RunCMake/CMakePresets: Do not forward empty CMAKE_MAKE_PROGRAM
7fb14e707d Tests/RunCMake/XcFramework: Use macosx SDK in all multi-arch macOS cases
70ff1f15fc Tests/CTestTest*: Detect compiler from environment
1faf60cffc Tests/FortranC: Handle empty CMAKE_OSX_SYSROOT
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: scivision <michael@scivision.dev>
Acked-by: FX Coudert <fxcoudert@gmail.com>
Merge-request: !9977
2024-11-08 11:50:31 -05:00
Alex Turbov
dd0142e6d0 cmDocumentationFormatter: Refactor the PrintFormatted() method
- Introduce the `std::string Format(std:string)` method
- Simplify the algorithm to use `cmTokenizedView()` instead of pointers manipulation and slow iostreams
- Formatted text chunks are collected as a sequence of string views to join once at the end
2024-11-07 20:46:37 +04:00
Alex Turbov
ef88ec41f3 testDocumentationFormatter: Add some more test cases 2024-11-07 20:08:37 +04:00
Brad King
8353e6ab8d Merge topic 'vs-custom-command-disable-parallel-build'
4ee8705b12 VS: add source property VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9958
2024-11-07 10:07:03 -05:00
Brad King
3a51367548 Merge topic 'refactor-cmTokenize'
f3f70c2f90 StringAlgorithms: Refactor `cmTokenize()` function

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9944
2024-11-07 10:06:04 -05:00
Brad King
d3edfba804 Merge topic 'ninja-regenerate-scripts'
f50fb77a4f Ninja: Regenerate when test or install scripts are missing
79349dee01 cmake: Always update timestamps on test and install scripts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9923
2024-11-07 10:03:32 -05:00
Brad King
c417507523 Merge topic 'ctest-remove-handlers'
2b052ad5ca cmCTestUploadCommand: Remove handler usage
db3ccdce41 cmCTestUploadHandler: Move class into cmCTestUploadCommand.cxx
1b8f9274b2 cmCommand: Remove
8768a0c6e1 cmCTest*Command: Port away from cmCommand
c98ed10d0f cmCTest*Command: Declare member functions const
0e995d4897 cmCTest*Command: Direct use of cmExecutionStatus
26a697f7c1 cmCTest*Command: Access Makefile through an alias
caa449493b cmCTest*Command: Fortify argument parsing
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9968
2024-11-07 10:02:05 -05:00
Brad King
7b19531291 macOS: Do not pass any SDK/-isysroot to compilers by default
On modern macOS, compiler wrappers like `/usr/bin/cc` automatically
choose a SDK to pass via `-isysroot` to an underlying compiler from
Xcode or the CommandLineTools.  Other toolchains like Homebrew's `gcc-*`
come with a default SDK too.  Therefore, when targeting macOS, we no
longer need to choose any SDK or pass an `-isysroot` flag by default.

Update initialization of `CMAKE_OSX_SYSROOT` to be empty by default when
targeting macOS.

Fixes: #19180
2024-11-07 09:46:10 -05:00
Brad King
9eb530842c Tests/RunCMake/CMakePresets: Do not forward empty CMAKE_MAKE_PROGRAM 2024-11-07 09:46:09 -05:00
Brad King
7fb14e707d Tests/RunCMake/XcFramework: Use macosx SDK in all multi-arch macOS cases
We select the list of macOS architectures based on the version of Xcode.
Therefore we should use a macosx SDK that comes with Xcode to make sure
it has all the selected architectures.  For example, on macOS 10.15 the
system `/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk` SDK
may have only `x86_64`, but Xcode 12 can be installed with SDKs that
support both `arm64` and `x86_64`.
2024-11-07 09:46:09 -05:00
Brad King
70ff1f15fc Tests/CTestTest*: Detect compiler from environment
Three of these tests were still using the compiler selected for building
CMake itself.  In general our test suite is supposed to let each test
select the compiler from the environment.  This is particularly
important on macOS where CMake might be built with compilers inside
Xcode, which require an explicit `CMAKE_OSX_SYSROOT`.
2024-11-07 09:46:09 -05:00
Brad King
1faf60cffc Tests/FortranC: Handle empty CMAKE_OSX_SYSROOT
The compiler inside Xcode requires an explicit `-isysroot`.
Replace it with the `/usr/bin/cc` wrapper.
2024-11-07 09:45:54 -05:00
Brad King
87a9e50995 Tests: Add missing include in sleep sources
Sources that use `atoi` need to include `<stdlib.h>`.
2024-11-07 09:45:54 -05:00
Darragh Coy
4ee8705b12 VS: add source property VS_CUSTOM_COMMAND_DISABLE_PARALLEL_BUILD
This boolean setting allows parallel building to be disabled for
individual source files built via `add_custom_command`. Using this
option is equivalent to setting policy `CMP0147` to the `OLD` behavior.

Closes: #26413
2024-11-06 13:29:57 -05:00
Alex Turbov
f3f70c2f90 StringAlgorithms: Refactor cmTokenize() function
- Refactor and optimize the loop to make it shorter and faster
- Make it push elements into an arbitrary (templated) output iterator
- Make it a template on a separator type with the most used defaults
- Add a backward compatible signature to return `std::vector<std::string>`
- Add an alternative function `cmTokenizedView()` to return a vector of string views
2024-11-06 18:42:17 +04:00
Martin Duffy
f50fb77a4f Ninja: Regenerate when test or install scripts are missing
Rerun CMake when `cmake_install.cmake` or `CTestTestfile.cmake` are out
of date.  This enables regeneration if a subdirectory is removed before
invoking `ninja`.

Fixes: #26396
2024-11-06 08:35:57 -05:00
Brad King
85d0e377f7 Merge topic 'LINKER-prefix-generalization'
61aee8c7bd Add support of "LINKER:" prefix for Windows executable creation
8bcf9c7a3e Add support of "LINKER:" prefix for artifact creation flags
2bd4c06c26 Refactoring cmRulePlaceHolderExpander: propagate cmBuildStep information
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9922
2024-11-05 09:08:44 -05:00
Daniel Pfeifer
caa449493b cmCTest*Command: Fortify argument parsing
Fix tests that pass `CDASH_UPLOAD` or `SCHEDULE_RANDOM` without an argument.
2024-11-05 10:20:12 +01:00
Daniel Pfeifer
ff2ec0387a cmCTest*Command: Generalize argument parsing and checking
Move the instantiation of unparsed arguments as well as the `parser.Parse` call
behind an abstraction.  Merge checks on `captureCMakeError`.
2024-11-05 10:20:12 +01:00
Brad King
f3f0cb31a2 Tests/RunCMake/CTestTimeout: Improve reliability when running on busy hosts
The `Signal` case occasionally reaches the `TIMEOUT_SIGNAL_GRACE_PERIOD`
before the test process has a chance to print its `SIGUSR1` count.
Extend the grace period to make it less likely to be exceeded.
2024-11-04 16:43:59 -05:00
Marc Chevrier
61aee8c7bd Add support of "LINKER:" prefix for Windows executable creation
The following variables now support the LINKER: prefix:
* CMAKE_<LANG>_CREATE_WIN32_EXE
* CMAKE_<LANG>_CREATE_CONSOLE_EXE
2024-11-04 17:08:03 +01:00
Marc Chevrier
8bcf9c7a3e Add support of "LINKER:" prefix for artifact creation flags
The following variables now support the LINKER: prefix:
    * CMAKE_SHARED_LIBRARY_CREATE_<LANG>_FLAGS
    * CMAKE_SHARED_MODULE_CREATE_<LANG>_FLAGS
    * CMAKE_<LANG>_LINK_FLAGS
2024-11-04 17:08:03 +01:00
Marc Chevrier
35350c419d Add support of "LINKER:" prefix for CMAKE_<TYPE>_LINKER_FLAGS variable
The following variables now support the LINKER: prefix:
* CMAKE_<TYPE>_LINKER_FLAGS
* CMAKE_<TYPE>_LINKER_FLAGS_<CONFIG>

Fixes: #26171
2024-11-04 17:07:58 +01:00
Brad King
384dbef61e Merge topic 'normalize-input-paths'
799602b983 cmQtAutoMocUic: Remove now-unnecessary mutex around CollapseFullPath
5ca6234d13 KWSys: Remove path translation map settings for build within CMake
74c497ca65 Merge branch 'upstream-KWSys' into normalize-input-paths
10a381e446 KWSys 2024-11-04 (bef1f021)
73dddffe32 KWSys: Disable the path translation map for build within CMake
b378781c5d cmSystemTools: Cache ToNormalizedPathOnDisk actual-case lookups
622596c6b2 cmSystemTools: Re-implement ToNormalizedPathOnDisk without translation map
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9969
2024-11-04 10:09:16 -05:00
Brad King
847f74d294 Merge topic 'swift-spaces'
75e4cd8d18 Ninja: Fix escaping of paths with spaces for Swift tooling

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9956
2024-11-04 09:40:48 -05:00
Brad King
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory
Track the current working directory with symbolic links preserved.
2024-11-03 08:26:36 -05:00
Brad King
f9f4ab55ac Merge topic 'path-resolver'
1a6015e5fc PathResolver: Add helper to compute normalized paths
2a6f86ec5e Tests/CMakeLib: Remove stray output from test loop
646f37b473 clang-tidy: disable modernize-concat-nested-namespaces

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9965
2024-11-03 08:19:10 -05:00
Brad King
9fdf716ee8 Merge topic 'debug-adapter-value-formatting'
41621c3afb Debugger: Add Value Formatting support for StackTrace request

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9940
2024-11-01 09:16:18 -04:00
Winfried Auner
75e4cd8d18 Ninja: Fix escaping of paths with spaces for Swift tooling
If a path inside a project contains spaces, the generated Ninja
definitions previously contained superfluous quotes.

Fixes: #26404
2024-11-01 08:59:32 -04:00
Brad King
1a6015e5fc PathResolver: Add helper to compute normalized paths
Create a `cm::PathResolver` helper to compute normalized paths.
Provide a common implementation with compile-time dispatch to
select details w.r.t. symbolic links, existence, and matching
the on-disk case of existing paths.  Later we can use this to
implement:

* `ToNormalizedPathOnDisk`: Normalizes paths while resolving symlinks
  only when followed by `..` components.  Does not require paths to
  exist, but reads on-disk case of paths that do exist (on Windows).

* `GetRealPath`: Normalizes paths while resolving all symlinks.
   Requires paths to exist, and reads their on-disk case (on Windows).

* `CollapseFullPath`: Normalizes paths in memory without disk access.
  Assumes components followed by `..` components are not symlinks.

Abstract filesystem access through runtime dispatch so that we can test
Windows symbolic link and network path behavior without relying on real
environments.  The overhead of runtime dispatch should be insignificant
during real filesystem access.

Issue: #16228
Issue: #17206
2024-11-01 08:44:17 -04:00
Brad King
2a6f86ec5e Tests/CMakeLib: Remove stray output from test loop 2024-10-31 09:51:33 -04:00
Jonathan Phippen
41621c3afb Debugger: Add Value Formatting support for StackTrace request
Add support for the "format" property of the Debug Adapter Protocol
StackTrace request to fulfill the host's request to format the resulting
StackFrame name differently.
2024-10-29 13:29:00 -07:00
Brad King
1029cd338b Merge topic 'CMP0174-OLD-regression-repeated-keyword'
c8567acc32 cmake_parse_arguments: Restore capture of value after repeated keyword

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9953
2024-10-29 09:38:15 -04:00
Craig Scott
c8567acc32 cmake_parse_arguments: Restore capture of value after repeated keyword
When a single-value keyword is repeated, and the first instance is
missing a value, it prevents the value from the second instance from
being stored in a variable. This was a regression introduced by
commit ceeea4e511 (cmake_parse_arguments: Set variable if empty string
given after keyword, 2024-08-18). That change also didn't create a
variable if the keyword was given but without a value. The purpose
of the change was to always define a variable if a keyword was given.
Lastly, that change didn't protect the CMP0174 logic to make it only
apply to the PARSE_ARGV form.

The first two of the above problems are fixed here by tracking the
keywords given instead of checking which keywords were missing
values. The third problem is also fixed here, being tightly coupled
to the same logic as the first two problems.

Fixes: #26397
2024-10-28 09:47:21 -04:00
Brad King
323638f573 Merge topic 'libuv-error-mode-backport'
0f515c2d26 libuv: win/spawn: add option to use parent process error mode
728f40d4bf libuv: win/spawn: allow exception through to OS

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9931
2024-10-28 09:32:24 -04:00
Brad King
87778f46ca Merge topic 'custom_command-depfile-management'
8979e7aaab add_custom_command(DEPFILE): avoid duplicate entries in dependencies

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9945
2024-10-28 09:30:26 -04:00
Brad King
5ecb751092 Merge topic 'test-RunCMake.CTestTimeout'
bdec4219ad Tests/RunCMake/CTestTimeout: Improve reliability when running on busy hosts

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9948
2024-10-28 09:15:52 -04:00
Brad King
4f0c36ba41 Merge topic 'link-strategy'
39fd396421 LINK_LIBRARIES_STRATEGY: Rename strategies to clarify expectations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !9949
2024-10-28 09:14:40 -04:00
Brad King
f42962bfbf Merge topic 'link-strategy' into release-3.31
39fd396421 LINK_LIBRARIES_STRATEGY: Rename strategies to clarify expectations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Acked-by: Craig Scott <craig.scott@crascit.com>
Merge-request: !9949
2024-10-28 09:14:39 -04:00
Brad King
8779b1ad28 Merge branch 'backport-ci-fedora-41' into ci-fedora-41 2024-10-26 06:02:18 -04:00
Brad King
92272c4a17 Tests/RunCMake/BuildDepends: Skip LinkDepends with broken GNU ld 2.43
Issue: #26401
2024-10-26 06:01:09 -04:00
Brad King
be540dbe19 Tests: Fix FILE stream leaks in helper programs 2024-10-26 05:47:19 -04:00
Brad King
39fd396421 LINK_LIBRARIES_STRATEGY: Rename strategies to clarify expectations
Since commit 7abd3137b7 (Linking: Optionally reorder direct dependencies
from LINK_LIBRARIES, 2024-09-19, v3.31.0-rc1~53^2) the strategy name
`PRESERVE_ORDER` has led users to expect that it strictly preserves
order.  While the part of the link line generation logic controlled by
`LINK_LIBRARIES_STRATEGY` does preserve order, it is not the last step.
Toolchain-specific de-duplication can cause the order to change on the
actual link line generated in the build system.

Rename the strategies:

* `PRESERVE_ORDER` => `REORDER_MINIMALLY`
* `REORDER`        => `REORDER_FREELY`

The new names make it clear that reordering is always possible, just to
varying degrees.  Update the `LINK_LIBRARIES_STRATEGY` documentation to
clarify that the strategies do not directly control the final link line.

Fixes: #26400
Issue: #26271
2024-10-25 10:23:37 -04:00
Brad King
bdec4219ad Tests/RunCMake/CTestTimeout: Improve reliability when running on busy hosts
The `PropertyOverridesVar` case occasionally reaches the `TIMEOUT`
property's timeout, which is not what the test expects.  Extend the
property's timeout to make it less likely to be reached.
2024-10-25 09:25:03 -04:00
Dylan Snelgrove
0f515c2d26 libuv: win/spawn: add option to use parent process error mode
Backport changes from libuv v2 commit `8ad246557a` (win,process: allow
users to configure child error mode, 2024-10-17) to add the
`UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE` option.

Also use `UV_PROCESS_WINDOWS_USE_PARENT_ERROR_MODE` to keep
the behavior the same as before the option was added,
all child processes would be spawned the the parent's
error mode.

Issue: #20115
2024-10-25 08:51:45 -04:00