99318e49b9 Help: Mention when diagnostics were added
daec98ba61 Diagnostics: Fix passing diagnostic state to try_compile
e0b0ac4295 Diagnostics: Overhaul warnings in cmake-gui
ca5d569524 Diagnostics: Switch state to new system
618c074a8c Diagnostics: Use categories for presets
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !11855
Since commit baa33acbda (AIX-GNU: Put implicit link directories in
runtime libpath, 2013-02-14, v2.8.11~184^2~1) we explicitly add the GNU
compiler driver's builtin RPATH entries. Extend commit f08dcbffec
(Property: Add INSTALL_REMOVE_ENVIRONMENT_RPATH property, 2019-07-12,
v3.16.0-rc1~350^2~1) to exclude them.
Fixes: #27738
Commit 03f19aa4ea (cmSystemTools: Fix path traversal vulnerability in
archive extraction, 2026-01-06, v4.3.0-rc1~179^2) incidentally
introduced the `ARCHIVE_EXTRACT_SECURE_SYMLINKS` flag when extracting
archives, which prevents extraction of objects whose location would be
altered by a symlink on disk. However, this particular behavior change
was never documented or tested alongside the other changes in the
commit (absolute paths and path traversal components).
Divergent behavior of this flag from `libarchive` on Windows and
non-Windows platforms needs further investigation. In particular, on
Windows, archives cannot be extracted through directory symlinks, but
can be extracted through junctions. On Linux, archives *can* still be
extracted through symlinks, and archives containing symlinks can be
extracted as well.
The symlink change breaks compatibility with many common use cases of
existing projects, e.g., when extracting an archive inside a symlinked
build directory. Revert the flag until this issue can be explored in a
future version of CMake.
Fixes: #27752
Reported-by: scivision <scivision@users.noreply.github.com>
Do not propagate deprecated diagnostic variables to try_compile.
Instead, if any diagnostic is ignored in the calling instance, also
ignore it in the try_compile instance.
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.
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.
427cf86cb8 cmCMakePresetsGraph: better name for a local variable of `PrintPresets`
0f3347bb27 cmCMakePresetsGraph: generalize printing presets of different types
9638624ebe cmCMakePresetsGraph: move the static `PrintPresets` out of class
f60a1270bc cmCMakePresetsGraph: move static members to private scope
0bf8df384c cmCMakePresetsGraph: use `std::setw` instead of for-loop + one space at time
43a18bfaee cmCMakePresetsGraph: simplify presets printing
9aa7036093 cmCMakePresetsGraph: `printPrecedingNewline()` no need to be a member
37853f25b7 cmCMakePresetsGraph: `class` -> `typename` in template declarations
...
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11822
This was missed in commit ee83165923 (cmake: Explicitly normalize
input paths as they exist on disk, 2024-10-17, v4.0.0-rc1~597^2),
causing `CMAKE_CURRENT_LIST_FILE` in `cmake -P` scripts to be
regressed by the KWSys behavior change merged by commit e9bd437a43
(Merge branch 'upstream-KWSys' into normalize-input-paths,
2024-10-24, v4.0.0-rc1~589^2~1).
Issue: #27750
This was broken by refactoring in commit dab5e6ebb1 (introduce
cm::CMakeString class as helper for string() command, 2025-10-06,
v4.3.0-rc1~510^2~2).
Fixes: #27749
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.
The Debian `lintian` tool reported the dbgsym package issue as
`md5sums-lists-nonexistent-file`.
The DEB generator writes `md5sums` entries by stripping a top-level prefix
from each packaged file path. That used `CPACK_TEMPORARY_DIRECTORY`, which
works for regular debs but not for dbgsym packages.
Dbgsym package files are collected from `GEN_DBGSYMDIR` and passed to
`DebGenerator` with `WorkDir` rooted there. Because the `md5sums` writer
stripped `TemporaryDir` instead, the prefix did not match and absolute
staging paths leaked into `md5sums`.
Strip `WorkDir` instead. That is the actual root of `PackageFiles` for both
regular deb and dbgsym package generation, so `md5sums` entries stay
relative in both cases.
Remove public type `PrintPrecedingNewline` and its pointer passing
to every printing function.
It's enough to have a static flag variable inside the `printPrecedingNewline()`.
When indexing occurs twice at exactly the same time, there was a possibility
for snippets to show up in more than one index file, and therefore to be
removed by one indexing process while another indexing process ran a user
callback which needed to read the file.
Add a file locking mechanism around indexing to prevent it from happening
concurrently within a project build tree.
Fixes: #27741
The POSIX pipe read wrappers stored the return of ::read() into an
unsigned result, so a negative count (e.g. EBADF from a concurrent
close on another thread) became SIZE_MAX. ContentReader::buffer()
would then try to grow its deque by ~18 exabytes and crash with
either std::length_error (glibc) or a stack smash (libc++). Treat
any non-positive ::read() return as EOF/error, close the pipe, and
return 0 so the peer's SessionThread observes a clean empty payload.
cmDebuggerPipeClient is test-only infrastructure; production cmake
is always the pipe server. Production close() assumes sequential
access, which holds in normal use (the adapter destructor joins
SessionThread before closing the connection). The new abrupt-
disconnect test however needs to wake a sibling thread blocked in
read() on the same fd, which Linux ::close() does not do.
Add a ShutdownForTesting() method that calls shutdown(SHUT_RDWR)
without freeing the fd, so any concurrent blocking read wakes
with a clean zero-length return. On Windows, CloseHandle already
cancels pending overlapped I/O, so the helper just forwards to
close(). Use it from testProtocolWithPipesAbruptDisconnect in
place of close().