1246 Commits
Author SHA1 Message Date
AJIOB 0aa1eaf506 Source: Reduce string allocations, part 4 2026-09-22 11:37:41 +03:00
AJIOB cb20c5bd89 Source: Reduce string allocations, part 2 2026-09-22 11:37:41 +03:00
Brad King 7b5df521e8 Merge topic 'reduce-realloc'
c8b93b9db6 Source: Reduce string allocations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12503
2026-09-15 09:49:34 -04:00
AJIOB c8b93b9db6 Source: Reduce string allocations 2026-09-11 23:11:52 +03:00
Tyler Yankee 1cd84285e7 cpack: Add CLI argument spell checking
Use Levenshtein distance to track when the user may have made a typo in
an argument to `cpack`.
2026-09-11 08:23:35 -04:00
Tyler Yankee 314c720eaf cpack: Fail-fast on unknown arguments 2026-09-11 08:23:34 -04:00
Maximilian Sander 2a9cde8b6e presets: Add defined listings with unavailable reasons
Add workflow and per-type defined values to cmake --list-presets.
Each -defined value lists every non-hidden preset of the selected type
and explains why unavailable presets cannot be used. The defined value
is an alias for configure-defined.

Support --list-presets=defined in cmake build and workflow modes,
ctest, and cpack. Propagate configure preset unavailability to
dependent build, test, package, and workflow presets.

Fixes: #28016, #26118
2026-08-19 16:47:50 +02:00
Maximilian Sander 7de3c48731 Add '\n' to error output, missed in f134468a98 2026-07-28 00:51:55 +02:00
Steve Peters cbb903efd9 CPack: Archive files in a reproducible order
Issue: #23466
2026-05-15 13:55:25 -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 81c22a67b6 presets: Factor out command line arguments
Create a separate hierarchy of classes to manage command-line arguments
for CMake presets to facilitate shared definitions across our programs.
2026-04-30 07:49:43 -04:00
Mickaël Germain e99fbf4100 Presets: Extract ResolvePreset utility for preset resolution
Replace duplicated inline preset lookup/validation logic in cmake.cxx,
cmCTest.cxx, and cpack.cxx with a shared ResolvePreset<T> template
method on cmCMakePresetsGraph.

Use the PresetType::kind() static method introduced in commit
0f3347bb27 (cmCMakePresetsGraph: generalize printing presets of
different types) to derive error message strings, replacing the
runtime presetType string parameter with a template parameter.

Error messages for configure presets now consistently include
"configure" in the preset type (e.g., "No such configure preset")
matching the pattern used by build, test, and package presets.
2026-04-22 15:40:13 -07:00
Brad King f9170481f1 Merge topic 'cpack-nsis-ignore-components-page'
8046ceadf3 CPack/NSIS: Add option to not display component selection page

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11927
2026-04-15 09:40:25 -04:00
Chris Mocock 8046ceadf3 CPack/NSIS: Add option to not display component selection page
Fixes: #27754
2026-04-14 15:16:01 +01:00
Alex Turbov 1ef92d645d CPack/DEB: fix md5sums paths in dbgsym packages
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.
2026-04-12 07:37:49 +04:00
vvs31415 c33955688c cmCPackProductBuildGenerator: Modernize some code 2026-03-30 16:15:14 -04:00
Moyo Okeremi df9b089720 Source: Remove unnecessary #include on Windows
These are not covered by the IWYU job in CI.
2026-03-24 14:19:31 -04:00
Tyler Yankee 6014f09e97 cpack: Improve errors when no preset is specified
Add a better error message and tests to verify.
2026-03-19 10:18:31 -04:00
Brad King 942ec6308c Merge topic 'cmake-E-tar-encoding'
0c355dfcf7 tar: Use UTF-8 as a default encoding
21eb53e9eb tar: Add option to specify the encoding of archive pathnames
0435b76095 libarchive: Build with iconv to handle entry path encoding
24cb39e081 libarchive: Suppress upstream preference for MacPorts over macOS SDK
e07d0dacc9 cmArchiveWrite: Comment how we pass an entry pathname to libarchive
95040f37ed Tests/RunCMake/CommandLineTar: Improve formatting of error messages
e5c6c121c6 libarchive: Backport "Fix crash on failure to convert WCS/UTF-8 pathname"

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11601
2026-03-12 13:58:40 -04:00
Alex Overchenko 0c355dfcf7 tar: Use UTF-8 as a default encoding
Use UTF-8 by default, as this has become common for cross-platform
archive distribution, and our previous default was platform-specific.

Also revert commit f590010167 (libarchive: Restore tolerance of archives
with non-OEM paths on Windows, 2026-01-23, v3.31.11~1^2).  Its primary
purpose was to tolerate UTF-8 paths when extracting archives, which we
now handle by default.

Issue: #26903
2026-03-11 14:17:49 -04:00
Alex Overchenko 21eb53e9eb tar: Add option to specify the encoding of archive pathnames
Use OEM by default for backward compatibility

Fixes: #26903
2026-03-11 08:44:44 +03:00
Alex Overchenko 70b35324ec Source: Reduce const char* to std::string conversions 2026-03-10 11:45:36 -04:00
Alex Turbov 302a645d73 CPack/DEB: use triggers instead of legacy postXXX scripts for ldconfig 2026-03-05 23:14:10 +04:00
Rex Keen c6cefac938 CPack/Archive: Show filename causing same-file-different-content
When there are two files with the same name but different content, an
error is shown, but the error does not include the filename which caused
it. This adds the filename to the error.
2026-03-03 15:53:00 -05:00
Ivan Desiatov 781754f505 CPack/WiX: Add support for perUser install scope
This allows one to create installers that install to `AppDataLocal`
and do not require admin privileges to execute.

Fixes: #24939
2026-02-13 10:57:39 -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 ea47c154e5 Make case-dependent operations 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:50 -05:00
Brad King 05ed2af7da Avoid signed char-to-int conversions in tolower/toupper calls
These functions document that the arguments must be representable
by `unsigned char`.  In particular, NetBSD is strict about this.

Fixes: #27574
2026-02-06 10:39:52 -05:00
Brad King 538926c532 Merge topic 'cpack-archive-compression-level'
0bca70968a CPack: support archive compression level
54f926c740 libarchive: Limit lzma compression level to 6 on AIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11548
2026-01-12 09:40:51 -05:00
Brad King 5b4d2e9ea5 Merge topic 'fix-cmStrCat-2'
c42acbbecc Source: replace string addition to cmStrCat
32a68a0c40 Source: fix possible undefined behavior

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !11543
2026-01-12 09:22:20 -05:00
Brad King c3bd6ddaca Merge topic 'cpack-appimage-user-apprun'
078f28f16b CPack/AppImage: Add support for a custom AppRun file

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11577
2026-01-12 09:18:33 -05:00
AJIOB 0bca70968a CPack: support archive compression level
Fixes: #18117
2026-01-09 10:35:04 -05:00
Mathieu 078f28f16b CPack/AppImage: Add support for a custom AppRun file
Allow the users to install a custom AppRun file.
Otherwise create a default one.

Fixes: #27478
2026-01-09 09:41:03 -05:00
Alex Overchenko c42acbbecc Source: replace string addition to cmStrCat 2026-01-08 23:22:19 -05:00
Kevin Barre 07fe3f95ce CPack/DEB: Add CPACK_DEBIAN_COMPRESSION_LEVEL variable
Add a new variable `CPACK_DEBIAN_COMPRESSION_LEVEL` to control the compression
level used when generating Debian packages. This complements the existing
`CPACK_DEBIAN_COMPRESSION_TYPE` variable and allows finer control over the
compression performance vs. size trade-off. Supported values correspond to
the compression level accepted by the underlying compressor (e.g. gzip, xz,
zstd, etc.).
2025-12-17 14:27:10 -05:00
AJIOB 3db6cce657 cpack: 7z & zip supports compression algorithms
Fixes: #27461
2025-12-16 15:52:54 +03:00
AJIOB 1e4b829279 cpack: restore broken archive compression methods
Relates #27461
2025-12-16 08:23:18 +03:00
Ben Boeckel 366b25e62e ast-grep: simplify cmHasLiteral{Suf,Pre}fix with char literals 2025-11-20 12:14:14 -05:00
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 f49b0e6759 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:16 -05:00
Brad King 6dcfe66085 Merge topic 'cpack-archive-ownership'
5a18728cec CPack/Archive: Add support for setting UID/GID in archive

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11353
2025-11-10 09:15:13 -05:00
Clinton Stimpson 5a18728cec CPack/Archive: Add support for setting UID/GID in archive
Add `CPACK_ARCHIVE_UID` and `CPACK_ARCHIVE_GID` options.

Add a policy to change the default to 0/0 to enable ownership
by root if unpacking as root.

Fixes: #12901
2025-11-08 09:25:08 -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
Daniel Pfeifer 3c7fee0d99 CPack/NSIS: Allow setting CRCCheck
Fixes: #27260
2025-09-24 19:30:27 +02:00
Brad King 064df8a511 Merge topic 'wix-empty-components'
6e3f6e925d CPack/WiX: Allow multiple empty top-level components

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11172
2025-09-12 11:28:17 -04:00
Nils Gladitz 6e3f6e925d CPack/WiX: Allow multiple empty top-level components
Avoid generating empty / conflicting directory components for
the installation root which is shared across components and
(except for the degenerate case of an empty installer)
will always be created implicitly.
2025-09-11 15:18:50 +02:00
Nils Gladitz 193f17102f CPack/WiX: Implement opt-in per component .cab
By setting CPACK_WIX_CAB_PER_COMPONENT users can generate one
.cab per component instead of one .cab per installer.

WiX compresses .cab files in parallel.
This may potentially speed up installer creation.

May also allow larger installers (there is a 2GB per .cab limit).
2025-09-10 12:24:42 +02:00