Commit Graph

446 Commits

Author SHA1 Message Date
Brad King
8832f78dd6 IWYU: Update for Debian 13 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 13.  Some patterns:

* Types named in virtual `override` signatures no longer require
  includes since the overridden signature already names them.

* A function argument's type needs to be included even if its constructor
  is called only by implicit conversion.  For example, constructing a
  `std::function` from a lambda now requires `<functional>`.

* Some prior mysterious `<type_traits>` inclusions are no longer required.
2025-11-12 14:54:35 -05:00
Brad King
3593aa59ef cmake: Replace working mode with role 2025-11-07 09:35:55 -05:00
Brad King
accfa7fa81 cmake: Infer command failure action from role 2025-11-07 09:35:55 -05:00
Brad King
e290d4f2a3 cmake: Infer command set from role 2025-11-07 09:35:54 -05:00
Brad King
0aab75bf0e cmake: Clarify name of enum backing CMAKE_ROLE property 2025-11-07 09:35:53 -05:00
Brad King
9e36f22684 cmake: Clarify name of enum identifying set of commands added 2025-11-07 09:35:53 -05:00
Brad King
5078d5be4f cmake: Clarify name of enum identifying try_compile 2025-11-07 09:35:53 -05:00
Craig Scott
2f653056af presets: Detect abnormal termination of workflow step commands
If the command for a step (cmake, ctest, or cpack) terminates abnormally,
libuv sets the exit code to 0 and reports the process termination signal
in a separate struct member. That carries through to the structure we use
to track the process and ultimately give back to the workflow step loop.
Don't rely on the exit code alone to test for failure, also check for spawning
errors and abnormal termination too.

Fixes: #27273
2025-09-30 13:04:48 +10:00
Alex Turbov
cb07358256 cmake_language: add TRACE subcommand
Closes 27235.
2025-09-23 03:02:03 +04:00
Daniel Pfeifer
b1fdab3cc1 source: Pass small and trivially copyable types by value 2025-08-01 09:56:00 -04:00
Ben Boeckel
8180ecad9b autogen: support the SHORT intermediate dir strategy 2025-07-29 09:44:03 -04:00
John Parent
392543384f cmake: support setting the intermediate dir strategy from the environment 2025-07-28 12:01:28 -04:00
Daniel Pfeifer
46a0c04284 CTest: Allow setting exit code in ctest scripts 2025-03-20 16:31:49 +01:00
Brad King
6f0ad398f1 cmake-gui: Clarify "Open Project" button implementation details 2025-03-10 10:48:24 -04:00
Kitware Robot
1772622772 LICENSE: Replace references to Copyright.txt with LICENSE.rst
```
git grep -lz 'Copyright.txt or https://cmake.org/licensing ' |
  while IFS= read -r -d $'\0' f ; do
    sed -i '/Copyright.txt or https:\/\/cmake.org\/licensing / {
              s/Copyright.txt/LICENSE.rst/
            }' "$f" ; done
```
2025-03-03 10:43:35 -05:00
Martin Duffy
a2232db802 instrumentation: Make hooks compatible with presets 2025-02-17 11:03:28 -05:00
Martin Duffy
f62a4ab2ee instrumentation: Refactor cmInstrumentation constructor and usage
Creates a global cmInstrumentation pointer on the CMake Instance to
prevent creating multiple instrumentation objects.
2025-02-03 10:10:06 -05:00
Daniel Tierney
abbe41578d cmake: Add SARIF diagnostics output support
Closes: #26587
2025-01-29 08:43:19 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Brad King
381c446ff7 VS: Remove support for appending a platform to the generator name
Compatibility with CMake versions prior to 3.1 is no longer supported.

Fixes: #26481
2025-01-21 08:08:22 -05:00
Martin Duffy
097d4fd1b5 instrumentation: Collect and record project build system metrics
Add a feature for collecting build instrumentation for CMake projects.

Issue: #26099
2025-01-15 09:16:50 -05:00
Martin Duffy
fcbc883fa3 cmake: Allow configuration of default script names
Adds the ``--project-file`` command-line option to modify the default script
name loaded by CMake and ``add_subdirectory`` to values other than
``CMakeLists.txt``.

Fixes: #21570
2024-12-17 12:47:02 -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
Marc Chevrier
656267c871 COMPILE_WARNING_AS_ERROR: rename methods to prepare link similar functionality
Methods renamed:
* SetIgnoreWasinigAsError => SetIgnoreCompileWasningAsError
* GetIgnoreWasinigAsError => GetIgnoreCompileWasningAsError
2024-11-12 14:52:28 +01:00
Brad King
73dddffe32 KWSys: Disable the path translation map for build within CMake
It is about to be removed from KWSys.
2024-11-03 08:32:46 -05:00
Brad King
ee83165923 cmake: Explicitly normalize input paths as they exist on disk
`CollapseFullPath` has two use cases:

1.  Normalize input paths from command-line arguments and environment
    variables.  On Windows, load their on-disk capitalization.

2.  Simplify paths constructed internally.  These should already have
    the correct capitalization.

Audit all `CollapseFullPath` call sites and code paths leading to them.
Replace those calls that normalize input paths with calls to
`ToNormalizedPathOnDisk` to express that they need the on-disk case.

By making this distinction we will later be able to remove the on-disk
capitalization lookup `CollapseFullPath`, thus eliminating disk accesses
from internal path processing.

Issue: #20214
2024-10-22 13:26:19 -04:00
Aliaksandr Averchanka
31c0e0de49 presets: Add graphviz support
Closes: #22164
2024-07-30 10:27:03 -04:00
Arctic Lampyrid
6116bcb066 fileapi: Add CONFIGURE_DEPENDS glob info to cmakeFiles object
Fixes: #25668
Co-authored-by: Brad King <brad.king@kitware.com>
2024-03-19 14:55:25 -04:00
Arctic Lampyrid
f578515d02 cmGlobCacheEntry: Add helper to carry CONFIGURE_DEPENDS glob cache arguments 2024-03-20 02:30:53 +08:00
leha-bot
9f6c937408 Source/cmake.h: Add ScriptModeExitCode for proper storing exit code
From executed CMake script in SCRIPT_MODE.
2024-01-16 10:41:31 +03:00
Brad King
241ee252ce IWYU: Update for Debian 12 CI job
`include-what-you-use` diagnostics, in practice, are specific to
the environment's compiler and standard library.  Update includes
to satisfy IWYU for our CI job under Debian 12.
2023-07-28 09:14:08 -04:00
Craig Scott
99b2ccf80d cmake_file_api: New project command
Projects can use the new command to request file API replies for the current
run. No query files are generated, the query is tracked internally. Replies are
created in the file system at generation time in the usual way.

Fixes: #24951
2023-06-05 06:20:50 -04:00
Brad King
c4f273e722 Merge topic 'AddCacheEntry-suppress-raw-pointer-usage'
4fc322bab4 AddCacheEntry: Suppress raw pointer usage

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8520
2023-05-31 09:35:25 -04:00
Marc Chevrier
4fc322bab4 AddCacheEntry: Suppress raw pointer usage 2023-05-30 16:41:59 +02:00
Glen Chung
a9a592f96e cmake: Add debugger
- Depends on cppdap and jsoncpp.
- Add --debugger argument to enable the Debugger.
- Add --debugger-pipe argument for DAP traffics over named pipes.
- Support breakpoints by filenames and line numbers.
- Support exception breakpoints.
- Call stack shows filenames and line numbers.
- Show Cache Variables.
- Show the state of currently defined targets,
  tests and directories with their properties.
- Add cmakeVersion to DAP initialize response.
- Include unit tests.

Co-authored-by: Ben McMorran <bemcmorr@microsoft.com>
2023-05-30 09:46:12 -04:00
Marc Chevrier
aa5fed5052 SetProperty: suppress raw pointer usage 2023-05-26 14:48:22 +02:00
Artin Alavi
8e579b0228 presets: Add trace options to configure presets
Add JSON schema version 7 to support them.

Fixes: #22543
2023-03-30 09:18:53 -04:00
Brad King
48292c8624 try_compile: Record stack of in-progess checks in configure log
Many `try_compile` and `try_run` calls occur inside check modules
between `message(CHECK_START)` and `message(CHECK_{PASS,FAIL})` pairs.
Add a field to configure log entries to report this context.

Issue: #23200
2023-01-16 17:18:07 -05:00
Brad King
189557bd74 cmake: Make entire in-progress check stack available internally
Represent it as a `vector` so we can iterate over the whole stack.
2023-01-16 16:58:49 -05:00
Matthew Woehlke
746c776caf ConfigureLog: Add infrastructure for structured configure event logging
Add infrastructure for a "configure log".  Use YAML for a balance of
machine- and human-readability to records details of configure-time
events in a structured format.

Teach the RunCMake test framework to support matching the configure log.

Issue: #23200
2022-12-16 10:11:37 -05:00
Alex Turbov
74b735dea8 cmDocumentation: char*[][2]cmDocumentationEntry[N]
Use fixed size arrays of `cmDocumentationEntry` items instead of
open arrays of two `char` pointers when describe program options
help screens.

Also, drop `const char*[][2]` overloads of methods of
`cmDocumentation` and `cmDocumentationSection` classes in the sake
of generic (template) appenders introduced earlier.
2022-11-17 16:37:11 +04:00
Kyle Edwards
553794e987 cmake::CreateProfilingEntry: Refactor to take lambda for args 2022-11-11 11:45:00 -05:00
Brad King
3469d53b3f Merge topic 'extended-profiling'
0fe7aae91f cmake: Add profiling events for configure and generate
3d6a8d7eac cmMakefileProfilingData: Refactor to use RAII

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !7828
2022-10-28 10:04:01 -04:00
Brad King
ab88011579 Merge topic 'cmake-presets-workflow-arguments'
7ecbe324b0 cmake --workflow: add --fresh option
7d9aa0f00c cmake::Workflow: Refactor to use enum class argument
322193afcd cmake --workflow: print usage and exit on unrecognized argument
70aef29427 cmake --workflow: print usage message

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !7825
2022-10-27 09:43:39 -04:00
Kyle Edwards
3d6a8d7eac cmMakefileProfilingData: Refactor to use RAII
And add a more generic StartEntry() method.
2022-10-26 17:54:08 -04:00
Kyle Edwards
7ecbe324b0 cmake --workflow: add --fresh option
Fixes: #24073
2022-10-26 12:01:25 -04:00
Kyle Edwards
7d9aa0f00c cmake::Workflow: Refactor to use enum class argument 2022-10-26 12:01:01 -04:00
Matthew Woehlke
5ba51621af try_compile: Propagate --trace through try_compile
Add ability to specify another cmake instance from which to get the
trace output target. Use this during try_compile.
2022-10-11 12:10:18 -04:00
Kyle Edwards
374d82bbcd cmake: Add --workflow mode
Fixes: #23118
2022-09-27 11:09:06 -04:00
Robert Maynard
f808d8afb9 CMake: Support upcoming C++26 language level 2022-08-31 13:46:18 -04:00