1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-17 15:32:10 +08:00
Commit Graph

342 Commits

Author SHA1 Message Date
Martin Duffy
3db07b0189 cmInstallScriptHandler: Refactor to store config and path for each command 2025-09-24 12:41:32 -04:00
Tyler Yankee
fbb5b47fbf instrumentation: Rename postTest and postInstall hooks
`postCTest` and `postCMakeInstall` are more closely aligned with the
corresponding snippets which cause cause them to trigger (`ctest` and
`cmakeInstall`, respectively), and as such serve as better indicators of
their true behavior.
2025-09-04 12:39:39 -04:00
Brad King
509c424472 StdIo: Replace uses of KWSys Terminal with StdIo::Print
The latter:

* uses a type-safe representation of text attributes,

* works with `StdIo::Console` to print arbitrary UTF-8 text in color, and

* writes VT100 sequences to Windows Consoles when supported, eliminating
  racy console text attribute changes in parallel `make` output.

Fixes: #22450, #26689, #26924
2025-05-19 08:19:10 -04:00
Brad King
57b24e8fef StdIo: Init() automatically in Console()
Applications that initialize a `cm::StdIo::Console` immediately no
longer need to `cm::StdIo::Init` first.
2025-05-13 10:35:47 -04:00
Brad King
3e88020aed StdIo: Replace uses of KWSys ConsoleBuf with StdIo::Console
Issue: #26924
2025-05-13 10:35:47 -04:00
Brad King
cef4676d3a StdIo: Factor out helper to initialize stdin, stdout, and stderr
Move logic from commit c85524a94a (Ensure stdin, stdout, and stderr pipes
are always open, 2019-05-02, v3.15.0-rc1~171^2) and commit 96010cc968
(Ensure stdin, stdout, stderr FILE streams are open on Windows, 2024-01-24,
v3.29.0-rc1~65^2) to a dedicated source.  Expose it through an `Init` class
constructor to make it optionally available during static initialization.

Issue: #26924
2025-05-08 13:39:48 -04:00
Brad King
b4b0d3f118 cmDynamicLoader: Remove unused code
It has not been used since commit dc0c6734d3 (CMP0031: Remove support
for OLD load_command command, 2024-11-26, v4.0.0-rc1~174^2~21).
2025-04-21 19:36:26 -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
45d3ffaa95 instrumentation: Use auto for variables holding closures 2025-02-17 11:08:30 -05:00
Martin Duffy
a2232db802 instrumentation: Make hooks compatible with presets 2025-02-17 11:03:28 -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
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
ea8e3107ec cmake --install: Respect CMAKE_DEFAULT_CONFIGS
When `cmake --install` is run with no `--config` passed, use
`CMAKE_DEFAULT_CONFIGS` to determine which config(s) to install.

Fixes: #21475
2024-11-19 11:37:47 -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
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory
Track the current working directory with symbolic links preserved.
2024-11-03 08:26:36 -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
Kevin Tolle
b80aa1d3a3 preset: Easier command line interface for Workflow Presets
A positional option allows 'cmake --workflow --preset <preset>' to be
shortened to 'cmake --workflow <preset>'.

Fixes: #26270
2024-10-05 16:08:44 +10:00
Brad King
fe63f15383 Merge topic 'fileapi-config-dir'
1df94443fe fileapi: Add support for user-wide queries
a991a5019b Tests: Isolate test suite from user-wide configuration
320b81847d Tests: Remove unused cvs anonymous access credentials

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9744
2024-08-26 09:48:40 -04:00
Martin Duffy
1df94443fe fileapi: Add support for user-wide queries
Fixes: #19168
2024-08-22 10:24:23 -04:00
Alex Turbov
5b259985bf Refactor: Optimize some std::ostream::operator<<() calls 2024-08-19 19:42:31 +04:00
Brad King
72f2ef297b Merge topic 'help-options'
b5b36f95f9 Help: Add clarifying text for some help options

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9706
2024-08-19 10:31:32 -04:00
Martin Duffy
b5b36f95f9 Help: Add clarifying text for some help options
Fixes: #26193
2024-08-15 09:12:26 -04:00
Alex Turbov
4fbeeb97aa Refactor: … << "\n" << std::flush;… << std::endl; 2024-08-13 22:14:05 +04:00
Brad King
26302e120e Merge topic 'install-parallel-manifest'
9799491c7e install: Write manifest file in parallel install

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9673
2024-07-26 10:00:36 -04:00
Martin Duffy
9799491c7e install: Write manifest file in parallel install
Updates the parallel install to generate the install_manifest.txt file.
2024-07-25 12:36:32 -04:00
Brad King
077691942a Merge topic 'cmake-list-cached-variables'
c55239e286 cmake: Add flag to list cache entries matching a regex

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9644
2024-07-24 10:00:30 -04:00
Min Hsu
c55239e286 cmake: Add flag to list cache entries matching a regex
Add a `-LR[A][H] <regex>` flag with similar functionality to `-L[A][H]`,
but instead of listing all cached variables, it show only specific
variables that match the name regex.
2024-07-23 10:19:22 -04:00
Brad King
de8e176113 Merge topic 'parallel-install'
159ba027b9 Install: Add parallel installation option

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9611
2024-07-18 09:04:47 -04:00
Martin Duffy
159ba027b9 Install: Add parallel installation option
Fixes: #26000
2024-07-15 11:49:29 -04:00
Brad King
ead3548bed Merge topic 'xdg-config-dir'
5b3fbd5f64 cmSystemTools: Add CMake config directory

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9615
2024-07-08 11:23:33 -04:00
Martin Duffy
5b3fbd5f64 cmSystemTools: Add CMake config directory 2024-07-03 09:34:41 -04:00
Brad King
973bb02b14 cmake: Print --workflow option in --help output
This was missed in commit 374d82bbcd (cmake: Add --workflow mode,
2022-09-16, v3.25.0-rc1~76^2).
2024-07-02 08:37:29 -04:00
leha-bot
4f160f7906 cmakemain: Return the SCRIPT_MODE exit code if it was set
We determine it via checking cmake.Run() return code and
ScriptModeExitCode. If ScriptModeExitCode is zero, then we would return
1 if retcode was non-zero. Otherwise it will be returned if retcode was
  also non-zero.
2024-01-16 10:41:31 +03: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
e08ba229ee CMake code rely on cmList class for CMake lists management (part. 1) 2023-04-24 10:41:10 +02:00
Robert Maynard
f9e8a067c2 cmake: Stop parsing after -- when detecting script mode
The fix in commit 08aa516880 (cmake: Stop parsing after `--` when
detecting script mode, 2022-12-06, v3.26.0-rc1~216^2) only corrected the
case where `-P -- -P <arg>` occurred and not `-P -- -P -<other>`.

Fixes: #24220
2023-02-08 17:21:10 -05:00
Robert Maynard
08aa516880 cmake: Stop parsing after -- when detecting script mode
Fixes #24220
2022-12-06 13:04:31 -05:00
Alex Turbov
69918b07e1 cmDocumentationEntry: Drop all user provided ctors for C++ >= 14
There is no need for them cuz:

- the last field has a default value
- all static instances use 2 arguments convertible to `std::string`
- "dynamic" instances used for _Generator_ doc entries access
  fields diectly using default constructed instance

Moreover, compiler may generate move ctor/assign when needed.
2022-11-17 16:37:12 +04: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
Alex Turbov
8e2a03c078 ctest.cxx: Eliminate redundand trenary operator 2022-11-17 16:37:11 +04:00
Alex Turbov
95a3d91e5c cmakemain.cxx: Remove always true preprocessor #if block 2022-11-17 16:37:10 +04:00
Robert Maynard
01611f8258 cmake: --build improve detection of no build dir
Fixes #24157
2022-11-14 10:46:17 -05: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
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
Kyle Edwards
322193afcd cmake --workflow: print usage and exit on unrecognized argument
Issue: #24073
2022-10-26 12:00:57 -04:00
Kyle Edwards
70aef29427 cmake --workflow: print usage message 2022-10-25 10:52:07 -04:00
Juan Ramos
3c3bce133d cmake: Honor CMAKE_GENERATOR env var in --help output 2022-10-20 19:53:14 -06:00