556 Commits
Author SHA1 Message Date
Daksh Mamodiya fdc2c2b9c7 cmake-gui: settle preset application before Configure/Generate
Selecting a configure preset applies on the worker thread, but Configure
and Generate stayed enabled and could snapshot the stale cache model
first. Tokenize preset application, disable the dependent actions until
the completion lands, and accept only the latest request.

Fixes: #28085
2026-09-11 23:24:10 +05:30
Daksh Mamodiya 1493cd810c cmake-gui: Honor installDir from configure presets
The GUI ignored a preset's installDir, so CMAKE_INSTALL_PREFIX fell back
to the platform default instead of the value the command line uses. This
fixes that by reading installDir in QCMake::properties(), and while we're
there, it applies toolchainFile after the cacheVariables loop so both
override a same-named entry.

Fixes: #27804
2026-09-02 22:03:19 +05:30
Brad King fd05edbfa4 Merge topic 'fix-source-dir'
8073e676bd cmake-gui: fix receiving directory path from file dialogs

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12259
2026-07-14 09:08:12 -04:00
Eugene Shalygin 8073e676bd cmake-gui: fix receiving directory path from file dialogs
System file dialogs might return directory path with trailing slash,
which is a problem for source path, because then the ${sourceDirName} in
presets evaluates to empty string. Resolve that by stripping the
trailing slashes from source and binary dirs.
2026-07-09 16:47:05 +02:00
Joerg Bornemann 6862249daa cmake-gui: Fix crash when selecting a preset with a differing build dir
QCMake::setPreset() bound a reference to the selected preset's expanded
data inside CMakePresetsGraph.ConfigurePresets and then called
setBinaryDirectory().  When the selected preset's build directory holds a
cache whose CMAKE_HOME_DIRECTORY differs from the current source
directory (e.g. because the source path is reached through a symbolic
link, since browsing keeps the link unresolved while the cache stores the
real path), setBinaryDirectory() loads that cache and re-sets the source
directory.  That re-reads the presets graph via loadPresets(), which
calls ClearPresets() and destroys the map entry, leaving the reference
dangling.  Subsequent access crashed with a use-after-free.

Copy the expanded preset instead of holding a reference into the graph so
it stays valid across setBinaryDirectory().

Fixes: #27927
2026-07-09 09:28:26 -04:00
Tyler Yankee 95edd93948 presets: Support loading from arbitrary file
Allow CMake, CTest, and CPack to read presets from a path given by
command-line argument instead of always requiring `CMakePresets.json`
or `CMakeUserPresets.json` in the source tree. This makes the presets
feature more extensible to cases in which the user doesn't have access
to the presets defined in the source tree (e.g., if the source tree is
not writable).

For now, there is no equivalent implementation of such an option in the
`cmake-gui`, nor for the recent presets functionality implemented in
`ctest_configure` and `ctest_build`.

Fixes: #27329
2026-04-30 08:04:26 -04:00
Tyler Yankee e75b62fd73 presets: Convert allowNoFiles to enum class
This improves readability at the call site when "yes" is desired.
2026-04-30 07:49:42 -04:00
Tyler Yankee 43f5fc8ac8 Help, Tests: Consolidate presets terminology and references
References to `CMake[User]Presets.json` should correspond to behavior
pertaining to those files in particular, while references to presets
files generally should be disambiguated from that.

Re-spell "preset file" to "presets file" where applicable.

Make a few references to `cmake-presets(7)` more consistent.

Issue: #27329
2026-04-30 07:49:40 -04:00
Matthew Woehlke e0b0ac4295 Diagnostics: Overhaul warnings in cmake-gui
Replace the old (and poorly designed) mechanisms for altering warnings
in cmake-gui with a new warning tree that adaptively handles all
diagnostic categories that are defined.
2026-04-14 12:42:33 -04:00
Matthew Woehlke ca5d569524 Diagnostics: Switch state to new system
Add an additional state to the cmake instance to track diagnostics. Use
this to initialize any new/reset states we create so that other contexts
will inherit the diagnostic state from presets / command-line options.
Modify the front-end to map presets and -W command-line options to
manipulation of this new diagnostic state. Remove old members for
storing diagnostic state. Rework how diagnostic state is persisted.
Deprecate old, non-standard spellings for manipulating diagnostics.
Deprecate old 'dev' spelling for CMD_AUTHOR.

Note that this is a work in progress. Messaging has not yet been
updated, so the new state is not yet being used to control diagnostics,
and some of the logic to update the old state has been stripped (and
will eventually be removed entirely). Backward compatibility support for
the deprecated CMAKE_{WARN,ERROR}_DEPRECATED variables is only partially
implemented. The GUI's interface for manipulating warnings is partially
broken and needs to be overhauled. These tasks are being done in
separate commits in order to minimize review burden and keep the changes
per commit / per merge request more manageable.
2026-04-14 12:42:33 -04:00
Matthew Woehlke 618c074a8c Diagnostics: Use categories for presets
Modify diagnostics to track which preset schema version corresponds to
the introduction of each diagnostic. Modify how we parse presets to use
the set of diagnostics to generate bindings, and to store diagnostics as
maps rather than as fixed members. Enforce that only diagnostics known
to the specified preset version are present.

This is a first and necessary step toward moving CMake's internals over
to flexible categories rather than each category having its own bespoke
variables and member functions.

Note that the presets documentation currently contains some broken
links, as it is anticipating further documentation updates that will
happen in a future commit.
2026-04-13 10:41:18 -04:00
Matthew Woehlke 3f739b92ee clang-format: Fix order of QCmake* includes 2026-03-05 13:50:48 -05:00
Brad King 4f451d044a cmake-gui: Fix first-configure dialog appearance in Dark Mode on Windows
Since commit 1fef953655 (Utilities/Release: Update to Qt 6.10.1 on
Windows builds, 2025-12-08) our official binaries on Windows now honor
dark mode.  However, this dialog became unreadable, seemingly due to
QTBUG-123853.  Setting the wizard style to itself seems to work around
the problem.

Fixes: #27587
Qt-Issue: https://qt-project.atlassian.net/browse/QTBUG-123853
Suggested-by: Matthew Woehlke <matthew.woehlke@kitware.com>
2026-02-18 14:25:25 -05:00
Brad King 6ec707312d Make character classification locale-independent
Use ASCII-only ctype operations provided by KWSys String.
These match the "C" locale in which `cmake` has long run.
2026-02-11 11:55:54 -05:00
Brad King 633e4e494f cmake-gui: Remove unused option to link Qt5 windows plugins statically
Revert commit 27a73f1613 (cmake-gui: Add build option to use Qt5 windows
plugin statically, 2017-11-13, v3.10.0~3^2~1).  Our builds on Windows
all use Qt 6 now.
2025-12-11 10:30:57 -05:00
Ben Boeckel 366b25e62e ast-grep: simplify cmHasLiteral{Suf,Pre}fix with char literals 2025-11-20 12:14:14 -05:00
Joerg Bornemann 327f50083b cmake-gui: Fix {begin|end}ResetModel warnings
QStandardItemModel::beginResetModel() and
QStandardItemModel::endResetModel() calls cannot be nested, and Qt will
produce warnings at runtime if such nesting is detected.

The nesting happened in two places:
1. QCMakeCacheModel::setViewType calls QCMakeCacheModel::setProperties.
Both called beginResetModel.
2. QCMakeCacheModel::setProperties calls QStandardItemModel::clear(),
which also calls beginResetModel.

The fix for 1 is to remove the {begin|end}ResetModel calls from
setViewType. The setProperties calls take care of the
{begin|end}ResetModel calls.

The fix for 2 is to replace the clear() call with a call that removes
all data rows.

Issue: #27376
2025-11-13 08:08:15 -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 4a2d32e7c4 cmake: Remove unnecessary initialization of empty source and build paths
The explicit initialization with empty paths from commit 57bdc1a2f7
(cmState: Compute and store directory components., 2015-05-04,
v3.3.0-rc1~61^2~4) has not been needed since commit 6afd35b98a (cmState:
remove unused code, 2016-06-16, v3.7.0-rc1~90^2).
2025-11-07 09:35:52 -05:00
Brad King 0f18aa010e ci: Update to Qt 6.9.3 on macOS
Get Qt updates fix `cmake-gui` button rendering when compiled with a
macOS 26 SDK.

Issue: #27325
2025-11-04 09:58:38 -05:00
Brad King 2ae318bb5d cmake-gui: Install only necessary plugins for Qt 6 2025-11-03 11:05:04 -05:00
Brad King 74dec2c7fd cmake-gui: Detect Qt lib directory on macOS more robustly
Avoid assuming a specific path within a framework.
2025-11-03 11:05:04 -05:00
Brad King 0d1321770d cmake-gui: Clarify signature of QCheckBox::checkStateChanged callbacks
In commit cbf0d3da52 (cmake-gui: Port away from deprecated API in Qt >=
6.7, 2025-02-21, v4.1.0-rc1~755^2~4) we assumed that `Qt::CheckState` is
implemented as an `int`.  Spell out the type explicitly for the Qt 6.7+
callback signatures.
2025-11-03 11:05:04 -05:00
Brad King 7ebad5d201 cmake-gui: Refactor installation into CMake.app/Contents on macOS
Instead of mutating `CMAKE_INSTALL_PREFIX`, add a `CMake.app/Contents/`
prefix to install destinations besides the `cmake-gui` target itself.
2025-10-31 09:33:52 -04:00
Brad King a65d986850 cmake-gui: Simplify macOS bundle version logic 2025-10-31 09:33:51 -04:00
Richard Thomson 18f1f19c82 cmake-gui: Support configure presets version 3+ without generator field
Presets allow this since commit 06e6981336 (cmake-presets: Make
generator and binaryDir fields optional, 2021-03-26, v3.21.0-rc1~346^2).

Fixes: #25817
2025-09-01 14:34:06 -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 6f0ad398f1 cmake-gui: Clarify "Open Project" button implementation details 2025-03-10 10:48:24 -04:00
Brad King 4e7aed2cd2 Merge topic 'cmake-gui-incidental-errors'
e9c494005c cmake-gui: Fix regression that prints an incidental error on fresh build trees

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10429
2025-03-07 12:10:18 -05:00
Juan Ramos e9c494005c cmake-gui: Fix regression that prints an incidental error on fresh build trees
Since commit a872844908 (cmake-gui: Handle relative paths in the build
directory text input, 2024-04-24, v3.30.0-rc1~5^2), `cmake-gui` gave an
incidental error message even when a valid build directory was being
passed.  Fix this by checking for a non-empty path before using it.

Fixes: #26744
2025-03-06 11:13:06 -05: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
Brad King 67b6964efa Merge branch 'backport-license-rst' (early part) into license-rst 2025-03-03 10:42:50 -05:00
Brad King 3035ee4ff3 CMake: De-duplicate extraction of copyright line from license file 2025-03-03 08:59:09 -05:00
Brad King 068ea4bfc1 cmake-gui: Update credits in About dialog to reflect status quo 2025-03-03 08:59:08 -05:00
Brad King 3bdf63e84d Merge topic 'cmake-gui-reload-presets'
74be7f5d79 cmake-gui: Add 'Reload Presets' button, replacing reload timer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10361
2025-02-26 08:44:31 -05:00
Will Bowers 74be7f5d79 cmake-gui: Add 'Reload Presets' button, replacing reload timer
Previously the presets handler in the GUI was on a timer.  Because of
this, error messages got suppressed after the first one (even if the
error message is different from the one originally suppressed).

Add a "reload presets" button which forces the preset to reload, and
always provides an error message if the reload failed.

Fixes: #26707
2025-02-25 08:20:59 -07:00
Alexandru Croitor 245f5ca8b3 Tests: Make CMakeGUI test build with both Qt5 and Qt6
Fixes: #26710
2025-02-21 14:41:12 -05:00
Brad King e35d1ee4cd cmake-gui: Clarify variable name for selected Qt major version 2025-02-21 14:41:12 -05:00
Brad King 19a1c115e0 cmake-gui: Fix integer conversion warnings with Qt 6 2025-02-21 14:41:12 -05:00
Brad King cbf0d3da52 cmake-gui: Port away from deprecated API in Qt >= 6.7 2025-02-21 12:39: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 2cf04f3034 Source: Include BundleUtilities from running cmake at install time
Since commit 249a9bb44d (cmake-gui: use BundleUtilities in place of
custom script., 2010-10-14, v2.8.4~299^2) our install scripts include
the `BundleUtilities` module from our own source, rather than from the
`cmake` that's running at install time.  We've now long required a
`cmake` version high enough to have the `BundleUtilities` we need.
Avoid including a `BundleUtilities` that may be newer than the running
`cmake` understands.
2025-01-22 10:40:53 -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
Matthew Woehlke 99ac59d31b style: Remove trailing blank lines from all CMake sources
Our development workflow tooling prevents trailing blank lines
from being added, but some such lines remain from before that
was enforced.  Remove them to make it easier to rename files
without triggering enforcement.
2024-11-21 15:48:02 -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 967d3ea85c cmake-gui: Explicitly normalize input paths as they exist on disk 2024-10-22 13:26:19 -04:00
Daniel Pfeifer 58c5f77837 clang-tidy: fix readability-redundant-* warnings 2024-10-11 15:37:21 +02:00
Roc R. Currius a872844908 cmake-gui: Handle relative paths in the build directory text input
Interpret a relative path with respect to the previously configured
directory.
2024-06-05 10:35:05 -04:00