1258 Commits
Author SHA1 Message Date
Olaf Mandel c98126d433 CPack/DEB: Do not use lzma or bzip2 compression for control.tar
Since commit 57eed59f35 (CPack/DEB: Use the same compression type for
control tar, 2025-07-29), control.tar uses CPACK_DEBIAN_COMPRESSION_TYPE.
deb(5) allows lzma and bzip2 only for data.tar, so dpkg rejects packages
built with either type.  Fall back to gzip for control.tar in those cases,
as before that commit.

Fixes: #28169
2026-10-14 10:42:42 -04:00
Brad King 2c97630dfa cmXMLParser: Avoid APIs deprecated by expat 2.9.0 2026-10-07 09:43:10 -04:00
Brad King 85e050e594 Merge topic 'sstream-3'
509514e475 Source: migrate ostringstream usage to cmStrCat

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12587
2026-10-02 10:26:27 -04:00
Brad King 451b6ec64d Merge topic 'sstream-2'
5fba25c052 Source: migrate ostringstream usage to cmStrCat

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !12582
2026-10-01 10:14:32 -04:00
Cristian Adam 640361b655 CPack: Add APK generator
Package Android applications by driving the Android SDK build tools
(aapt2, d8, zipalign and apksigner) and the JDK directly, so that no
Gradle installation is needed.  Java code is taken from sources, `.jar`
and `.aar` files.  Maven dependencies, such as the AndroidX libraries,
can be listed in `CPACK_APK_MAVEN_DEPENDENCIES` to have them and their
dependencies downloaded at packaging time, resolved like Gradle does
from Gradle module metadata or POMs.  Nothing is downloaded otherwise.
Like the Android Gradle plugin, the shared C++ runtime of the NDK is
packaged for the native libraries that `readelf` finds linked to it.
The native libraries of several ABIs are packaged into one APK by a
superbuild that builds each ABI with `ExternalProject` and lists the
build trees in `CPACK_INSTALL_CMAKE_PROJECTS`.

See: https://bugreports.qt.io/browse/QTBUG-106495
2026-10-01 09:44:06 -04:00
AJIOB 509514e475 Source: migrate ostringstream usage to cmStrCat 2026-10-01 11:41:51 +00:00
AJIOB 5fba25c052 Source: migrate ostringstream usage to cmStrCat 2026-09-30 16:54:28 +03:00
AJIOB fa60523bf6 Source: fix ast-grep suggestions 2026-09-29 08:50:54 -04:00
AJIOB a0a17c9ce8 Source: fix almost all ast-grep suggestions 2026-09-29 08:50:54 -04:00
Brad King 196537e4ff Merge topic 'ast-grep-fixes-2'
66cfa81885 Source: fix ast-grep warnings

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12567
2026-09-29 07:19:43 -04:00
AJIOB 66cfa81885 Source: fix ast-grep warnings 2026-09-26 21:54:54 +00:00
AJIOB 6c7dfb3afd Source: reduce ostringstream usage for IFW 2026-09-24 20:49:12 +00:00
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