Commit Graph

506 Commits

Author SHA1 Message Date
Max Rijkers
92fc9f0c3c bootstrap: remove dead code
The workaround added by commit 04f442f755 (Workaround for short jump
tables on PA-RISC., 2014-11-04, v3.1.0-rc2~7^2) was only partially
removed by commit 6fdcf02aaf (bootstrap: remove dead branches,
2017-08-15, v3.10.0-rc1~250^2~2).  Remove the rest of it.

Also remove an unused check for Linux systems.
2026-04-24 09:43:21 -04:00
Daniel Pfeifer
3947842733 discover_tests: Add CMake command implementation 2026-03-26 10:36:21 -04:00
Brad King
29192751b1 Merge topic 'refactor-header-set-verification-split'
448dd01b1f cmGeneratorTarget: move header set verification to dedicated file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11837
2026-03-20 08:58:33 -04:00
Brad King
671ada703b Merge topic 'cmake-diagnostics'
a78f356ed9 Diagnostics: Shorten type names
2b7ee7137b cmStateSnapshot: CanPop* should be const
a0612aeb5d Diagnostics: Add cmake_diagnostic command
e74fbb3d44 Diagnostics: Implement diagnostic stack
d80a38e524 cmMakefile: Use enumeration for policy scope

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11818
2026-03-20 08:44:26 -04:00
Mickaël Germain
448dd01b1f cmGeneratorTarget: move header set verification to dedicated file
Move AddHeaderSetVerification, GenerateHeaderSetVerificationFile,
ResolveHeaderLanguage, and GenerateStubForLanguage out of the
monolithic cmGeneratorTarget.cxx into a new split file following
the existing cmGeneratorTarget_*.cxx pattern.
2026-03-19 12:08:37 -04:00
Matthew Woehlke
a0612aeb5d Diagnostics: Add cmake_diagnostic command
Add command to manipulate the new diagnostic stack/state introduced in
the previous commit. Start adding documentation for the system as a
whole.
2026-03-19 11:29:44 -04:00
Matthew Woehlke
e74fbb3d44 Diagnostics: Implement diagnostic stack
Create a stack state for managing diagnostics. This will eventually
replace some of the global state used for diagnostics, as well as
providing a mechanism to add additional diagnostics.

For now, this is only the stack manipulation with a bare minimum of
interface logic (in particular, the `block` and `include` commands).
Nothing actually looks at the diagnostic state yet, and the primary user
interface does not yet exist (although there are some references to it
already).
2026-03-18 14:32:21 -04:00
Marc Chevrier
737b1da9fe cmInstallDirs: Factor out helper for install directories
To enable the retrieval of the various default install directories,
introduce functions in the namespace `cm::InstallDirs`.
2026-03-15 09:09:51 +01:00
Daniel Pfeifer
a5d0e0fb69 cmEnvironment: Introduce class for a set of environment variables 2026-03-11 21:05:58 +01:00
Brad King
81c86aae4a libuv: Update build within CMake for 1.52.0 2026-03-08 19:45:13 -04:00
Marc Chevrier
dee8799d16 FileSet management: Introduce dedicated classes for generation
To manage the generation step, introduce cmGeneratorFileSet and
cmGeneratorFileSets classes.
These reorganizations of the code are done in preparation of the
implementation of SOURCES file set type as well as user's file set types.

Issues: #27550, #27383
2026-02-19 17:35:56 +01:00
Marc Chevrier
b45dcfd306 Extract cmTargetPropertyEntry class from cmGeneratorTarget class.
To enable to reuse this class in different classes.
2026-02-19 17:03:45 +01:00
Marc Chevrier
dab5e6ebb1 introduce cm::CMakeString class as helper for string() command
This class will be used, as helper for:
* string() command
* future $<STRING> generator expression
2025-11-14 16:44:29 +01:00
Brad King
e4708f007b GenEx: Factor out a dedicated evaluation Context structure
The context's local generator, configuration name, and language are
constant throughout evaluation.
2025-09-21 20:21:37 -04:00
Brad King
4697f7122b GenEx: Rename cmGeneratorExpressionContext to cm::GenEx::Evaluation
It has grown to hold information about the evaluation itself,
not just the context in which the evaluation occurs.
2025-09-21 20:21:32 -04:00
Ben Boeckel
757c40c478 cmObjectLocation: add a class to track object locations
With the feature to use a shorter path for the build tree, the install
tree may still want to use a longer path.
2025-08-07 11:24:32 -04:00
Brad King
14e21fa992 bootstrap: Compile with 64-bit time_t on 32-bit Linux if possible
Extend commit 1b9e8f833f (Linux: Compile with 64-bit time_t even on
32-bit architectures, 2025-06-26, v4.1.0-rc2~16^2) to `bootstrap`.
2025-07-16 14:28:39 -04:00
Brad King
575106995b Source: Drop support for KWSys Encoding without std::wstring methods 2025-06-09 09:50:26 -04:00
Brad King
d7dbfa22a1 cmSystemTools: Drop unused MakefileColorEcho function 2025-05-19 08:19:20 -04:00
Brad King
329d755dbd StdIo: Add a Terminal abstraction to print color text
Abstract over VT100 sequences and Windows Console text attributes.

This will replace KWSys Terminal, which does not integrate with C++
streams.

Issue: #26924
2025-05-19 08:16:56 -04:00
Brad King
40b0db5ffb cmConsoleBuf: Remove unused infrastructure
It has been replaced by `cm::StdIo::Console`.
2025-05-13 10:53:36 -04:00
Brad King
f9f1f9a8cd StdIo: Add a Windows Console adaptor for cin, cout, and cerr
On Windows, the only reliable way to read/write Unicode text from/to a
Console is to use `ReadConsoleW` and `WriteConsoleW` and convert from/to
wide-character encoding.  When `cin`, `cout`, and/or `cerr` are attached
to a Windows Console, use a custom C++ `streambuf` to handle the I/O.

This will replace KWSys ConsoleBuf, whose implementation is more complex
to support narrow output streams on Windows non-UTF-8 narrow encodings.
We only need to support UTF-8.

Issue: #26924
2025-05-13 10:35:47 -04:00
Brad King
d6a1ff59f1 StdIo: Provide metadata about stdin, stdout, stderr streams
Detect the kind of terminal to which they are attached, if any.

Issue: #26924
2025-05-11 09:13:16 -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
Roger Leigh
99c8abed55 kFreeBSD: Remove support for obsolete platform
kFreeBSD is no longer maintained or supported and was never an
officially-supported release architecture for Debian.

Closes: #26742
2025-03-05 11:57:49 -05:00
Brad King
00b6a4b592 bootstrap: Update copyright line extraction for reST markup in LICENSE.rst
Since commit 8d83487e60 (CONTRIBUTORS: Factor contributors list out of
license file, 2025-03-02) the copyright line has reStructuredText
markup.  Filter it out of the copyright line printed by `bootstrap`.
2025-03-05 06:48:39 -05:00
Kitware Robot
de273b2e11 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 09:56:07 -05:00
Brad King
2d42a5444f LICENSE: Rename Copyright.txt to LICENSE.rst
The name `LICENSE` is now more conventional.
Format as reStructuredText to improve rendering.
2025-03-03 09:55:56 -05:00
Roger Leigh
4f0fb73816 libuv: Remove kvm dependency for all BSDs except NetBSD
This dependency is not expressed in upstream libuv.  It was added to
CMake by commit 6a497bb0a3 (libuv: Link with kvm on FreeBSD, 2016-09-08,
v3.7.0-rc1~143^2~1).  It is needed only on NetBSD.

Fixes: #26722
2025-02-24 14:31:28 -05:00
Brad King
292aaffb78 Source: Remove unused cmCommandArgument{Lexer,Parser}
These were used only for the CMP0053 OLD behavior, which has
now been removed.
2025-01-20 09:46:55 -05:00
Alex Turbov
bc8621d999 Fix: A lot of typos in code found by typos
Yet another great code spellchecker: https://github.com/crate-ci/typos/

(Will be added later as a `pre-commit` hook)
2025-01-12 18:49:34 +04:00
Alex Turbov
78e45c2db6 Style: Replace TABs with spaces for indentation in some files
Mark files that must use TABs to indent in the `.gitattributes`.
Use space instead of TABs in sources and some data/test files.
2025-01-12 18:49:25 +04:00
Matthew Woehlke
91c31ada23 find_package: Actually find .cps files
Add a helper class to read CPS files. Use this to teach find_package how
to consider and accept .cps files in its search. (Note that no version
testing is performed at this time.) Add a simple test that we can find a
package from a .cps file and correctly extract the version information.

Note that this doesn't actually import anything from CPS yet.
2024-12-13 08:58:24 -05:00
Daniel Pfeifer
1b8f9274b2 cmCommand: Remove
Finally. All commands are immutable.
2024-11-05 10:20:12 +01:00
Brad King
5ca6234d13 KWSys: Remove path translation map settings for build within CMake
They no longer exist in KWSys.
2024-11-04 10:00:10 -05: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
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
Ben Boeckel
4df5a6fbb4 cmBuildDatabase: add initial structures
This class represents a build database as introduced by P2977R0. It
includes support for reading, writing, and merging.

See: http://wg21.link/p2977r0
2024-08-27 12:36:46 -04:00
Brad King
262a89c92b Merge topic 'export-refactor-for-cps'
ff24058e46 export: Use std::all_of to collect exports
20fa4ce8d8 export: Factor out CMake-specific export generation (2/2)
6c66340a64 export: Fix const placement
1bceab3520 export: Factor out CMake-specific export generation (*/2)
a6cc595772 export: Factor out CMake-specific export generation (1/2)
0352376e44 export: Immediately report actual version required

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9646
2024-07-25 11:16:52 -04:00
Matthew Woehlke
20fa4ce8d8 export: Factor out CMake-specific export generation (2/2)
In order to support generation of Common Package Specifications, the
mechanisms CMake uses to export package information need to be made more
abstract. The prior commits began this refactoring; this continues by
(actually) restructuring the classes used to generate the actual export files.
To minimize churn, this introduces virtual base classes and
diamond inheritance in order to separate logic which is format-agnostic
but depends on the export mode (build-tree versus install-tree) from
logic which is format-specific but mode-agnostic.

This could probably be refactored further to use helper classes instead,
and a future commit may do that, however an initial attempt to do that
was proving even more invasive, such that this approach was deemed more
manageable.

While we're at it, add 'const' in more places where possible.
2024-07-23 12:13:39 -04:00
Brad King
6ed2c348f2 Merge topic 'bootstrap-no-pkg-config'
35eb28bc76 bootstrap: Restore support for system jsoncpp and uv without pkg-config

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex Turbov <i.zaufi@gmail.com>
Merge-request: !9679
2024-07-23 09:52:09 -04:00
ojab ojab
35eb28bc76 bootstrap: Restore support for system jsoncpp and uv without pkg-config
In commit da5de7f9f3 (bootstrap: Allow --boostrap-system-* libraries
custom prefixes, 2024-03-03, v3.30.0-rc1~456^2) the non-pkg-config code
path for uv/jsoncpp/rhash all set `use_librhash_ldflags` instead of
their own variable.
2024-07-22 10:33:50 -04:00
Matthew Woehlke
a6cc595772 export: Factor out CMake-specific export generation (1/2)
In order to support generation of Common Package Specifications, the
mechanisms CMake uses to export package information need to be made more
abstract. As a first step toward this, refactor cmInstallExportGenerator
so that logic specific to config.cmake and Android .mk lives in separate
subclasses.

While we're at it, clean up the code style a bit and try to use moves a
bit more consistently.

This is step 1 of 2. The next step will refactor the individual file
generators along similar lines, which will also involve creating
additional classes for format-agnostic logic that is shared between
build-tree and install-tree variants.
2024-07-18 12:08:43 -04:00
Martin Duffy
5b3fbd5f64 cmSystemTools: Add CMake config directory 2024-07-03 09:34:41 -04:00
René Bertin
598bc70474 file: Add undocumented READ_MACHO subcommand on macOS
Provide a way to parse the architectures of a Mach-O binary.

Issue: #25952
2024-06-04 08:37:47 -04:00
Brad King
09c74c6d0c cmGeneratorTarget: Factor transitive property methods into own source 2024-05-20 19:29:15 -04:00
Brad King
feaca40931 cmGeneratorTarget: Factor link interface/impl methods into own source 2024-05-20 19:28:06 -04:00
Brad King
b4924c562a cmGeneratorTarget: Factor compatible interface properties into own source 2024-05-20 19:26:05 -04:00
Brad King
cdd7112a5d cmGeneratorTarget: Factor options-like usage requirements into own source 2024-05-20 19:24:48 -04:00
Brad King
881a46819e cmGeneratorTarget: Factor LINK_DIRECTORIES impl into own source 2024-05-20 19:23:13 -04:00