Commit Graph

1142 Commits

Author SHA1 Message Date
K. R. Walker
b1f956529a CPack/NSIS: Fix matching of reserved component names
"Console" unexpectedly matches the reserved name regex.  This revealed
that `cmCPackNSISGenerator::CreateComponentDescription()` needs to use
the name returned by `GetSanitizedDirOrFileName()` for the component
file glob.

Fix the change from commit a1af593291 (CPack: Support arbitrary
component name when packaging, 2024-05-01, v3.30.0-rc1~151^2~1) to
address these issues and add related checks to the `CPackNSISGenerator`
test case.

Issue: #23612
2024-08-19 14:25:31 -04:00
Ben Boeckel
ab26d334bf cmCPackExternalGenerator: ensure JSON is written before running the script
First, use `cmGeneratedFileStream` to avoid touching an existing file
unless its contents change and to get atomic replacement. Also add a
scope to ensure that the file is in place (at `fout`'s destructor)
before doing anything with the packaging scripts.

See: https://discourse.cmake.org/t/1773
2024-07-18 07:50:46 -04:00
Deniz Bahadir
a1af593291 CPack: Support arbitrary component name when packaging
CPack no longer blindly tries to create temporary packaging
(sub)directories that contain the verbatim name of a component, which
might contain characters that are not supported on the platform /
filesystem.
Instead, if the component's name contains a (possibly) problematic
character its MD5 hash will be used for that temporary packaging
(sub)directory.

Likewise, if the component's name resembles a reserved device name (e.g.
"COM1" on Windows) then the temporary packaging (sub)directory will get
this name prefixed with an underscore.
Similar, if it ends in a dot (on Windows) then the temporary packaging
(sub)directory will get this name suffixed with an underscore.

Fixes: #23612
2024-05-01 19:20:32 +02:00
Deniz Bahadir
af1d166387 cmCPackGenerator: Fix debug message in function PrepareGroupingKind 2024-04-30 18:36:25 +02:00
Deniz Bahadir
a522abe5c0 cmCPackGenerator: Fix comment in function InstallCMakeProject 2024-04-30 18:36:25 +02:00
Deniz Bahadir
87cfe9dd91 cmCPackGenerator: Slightly simplify function InstallProject 2024-04-30 18:36:25 +02:00
Deniz Bahadir
1350ed96ff cmCPackGenerator: Clean up and simplify function DoPackage 2024-04-30 18:36:25 +02:00
Deniz Bahadir
d26eed4c75 cmCPackGenerator: Clean up and simplify function PrepareNames 2024-04-30 18:36:25 +02:00
Deniz Bahadir
12123b5b6b cmCPackGenerator: Refactor copying of package files into own function 2024-04-30 18:36:25 +02:00
Deniz Bahadir
d488efa0b4 cmCPackGenerator: Refactor generation of checksum file into own function 2024-04-30 18:36:25 +02:00
Deniz Bahadir
60f5118c7b cmCPackGenerator: Handle CPACK_TEMPORARY_[INSTALL]_DIRECTORY properly
The variable `CPACK_TEMPORARY_DIRECTORY` is an internal variable that is
required for proper packaging. Historically, a second variable
`CPACK_TEMPORARY_INSTALL_DIRECTORY` existed as well which had the same
purpose. Both variables had to be set to the same value. Otherwise,
CPack would not succeed with packaging.
In order to ease CPack's usage, the variable
`CPACK_TEMPORARY_INSTALL_DIRECTORY` is now no longer used.

However, as it cannot be guaranteed that neither of these two (internal)
variables have been used in the wild, some mechanism was introduced to
preserve backwards-compatibility: If one of these variables is set, the
other variable will be set to the same value. If, however, both are set
to different values, CPack still fails but with an explicit
error-message.

Fixes: #25046
2024-04-24 11:08:32 +02:00
Andreas Oetken
d4a46314ac CPack: Enable Inno Setup generator on non-Windows hosts
Innosetup tools can be run on Linux using Wine, thus there is no reason
to block this in CMake.
2024-04-15 16:34:22 -04:00
Brad King
03884f4f32 CPack/WIX: Add support for WiX Toolset v4
Add a `CPACK_WIX_VERSION` option to specify version WiX for
which the project is configured.

Fixes: #23910
2024-03-24 15:26:39 -04:00
Brad King
d15c910a45 CPack/WIX: Remove "candle" from tool-agnostic error message 2024-03-22 09:58:42 -04:00
Brad King
ac25c645a7 CPack/WIX: Improve formatting of CPACK_WIX_CUSTOM_XMLNS expansion 2024-03-22 09:58:42 -04:00
Brad King
d2f4836f8e CPack/WIX: Prepare to provide version-specific WiX templates
Move our template for WiX Toolset v3 to a versioned location.
2024-03-22 09:51:06 -04:00
Brad King
438809d3ba cmCPackGenerator: Add option to FindTemplate to use alternate builtin path 2024-03-22 09:51:06 -04:00
Vitaly Stakhovsky
1a49b439a5 Source: Use cmValue::IsOn and IsOff
Speed up a bit by calling members directly.
2024-03-17 19:05:37 -04:00
Brad King
023720e10a cpack: Simplify config file selection 2024-02-27 14:51:48 -05:00
Brad King
cc3c603061 cpack: Simplify package directory selection logic 2024-02-27 14:51:47 -05:00
Brad King
a9ad70de76 Source: Avoid using CollapseFullPath just to get parent directory 2024-02-27 14:51:47 -05:00
Christoph Grüninger
c934a881e7 Reduce scope of variable
Found by Cppcheck (variableScope)
2024-02-14 20:46:03 +01:00
Christoph Grüninger
3850def5e6 Use prefix ++ operators for non-primitive types
Prevent unnecessary calls to copy constructor
Found by Cppcheck (postfixOperator)
2024-02-14 20:46:02 +01:00
Christoph Grüninger
95a9494974 Remove unused variable
Found by Cppcheck.
2024-02-14 20:46:02 +01:00
Max Gaukler
60661f6770 CPack/WiX: Make InstallScope configurable
Add a new `CPACK_WIX_INSTALL_SCOPE` variable to set the `InstallScope`
when using the default WiX template.  Set the default to the bug-free
value `perMachine`.

Fixes: #20962
2023-11-16 14:15:38 -05:00
Atılhan Emre Dursunoğlu
770efceccb CPack: Avoid adding duplicate files to archive when combining components
Fixes: #25280
2023-10-26 18:20:48 +03:00
Brad King
c54cb0000d Merge topic 'vector-emplace-back'
9ca6dfc280 Source: Reduce vector entry allocations and copies
aaeb2e0aa8 cmLinkItemGraphVisitor: Remove unnecessary syntax
d1c1e95331 cmCPackInnoSetupGenerator: Reserve space to reduce allocations

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8891
2023-10-24 08:33:07 -04:00
Rose
9ca6dfc280 Source: Reduce vector entry allocations and copies
Prefer `emplace_back` over `push_back`.
2023-10-23 11:18:32 -04:00
Rose
d1c1e95331 cmCPackInnoSetupGenerator: Reserve space to reduce allocations 2023-10-23 11:13:46 -04:00
Sean McBride
b373a22991 Fix clang -Wreserved-identifier by renaming an enum 2023-10-20 12:20:02 -04:00
Kyle Edwards
a5f98df778 Source: Fix mysterious new IWYU warnings 2023-08-29 10:51:30 -04:00
Ben Boeckel
0abde043d2 cmCryptoHash: prefer to cmSystemTools::ComputeFileHash 2023-08-08 13:23:55 -04:00
Ben Boeckel
ec5f1c489a cmCryptoHash: prefer to cmSystemTools::ComputeStringMD5
The latter call is no longer post-bootstrap only since 596439b1bb
(cmCustomCommandGenerator: Add option to transform depfile, 2020-10-05)
via !5325. Convert callers to just use `cmCryptoHash` directly and
remove the bootstrap guard.
2023-08-08 13:22:13 -04:00
Brad King
d8b6a750a0 Merge topic 'windows-tidy-cmstrcat'
d58253d155 clang-tidy: fix `performance-faster-string-find` lints
a19ec77200 clang-tidy: fix `readability-static-accessed-through-instance` lints
3d03629f20 cmWIXRichTextFormatWriter: remove identity cast
1df29567ac clang-tidy: fix `modernize-use-equals-default` lints
32fe862b8c clang-tidy: fix `readability-container-size-empty` lints
7eaab9a957 clang-tidy: fix `modernize-raw-string-literal` lints
ffa49c23aa clang-tidy: fix `readability-else-after-return` lints
4489e9a85c clang-tidy: fix `modernize-use-auto` lints
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !8668
2023-08-01 09:31:45 -04:00
Ben Boeckel
d58253d155 clang-tidy: fix performance-faster-string-find lints 2023-07-30 20:19:49 -04:00
Ben Boeckel
a19ec77200 clang-tidy: fix readability-static-accessed-through-instance lints 2023-07-30 20:19:48 -04:00
Ben Boeckel
3d03629f20 cmWIXRichTextFormatWriter: remove identity cast 2023-07-30 20:19:48 -04:00
Ben Boeckel
1df29567ac clang-tidy: fix modernize-use-equals-default lints 2023-07-30 20:19:48 -04:00
Ben Boeckel
32fe862b8c clang-tidy: fix readability-container-size-empty lints 2023-07-30 20:19:48 -04:00
Ben Boeckel
7eaab9a957 clang-tidy: fix modernize-raw-string-literal lints 2023-07-30 20:19:48 -04:00
Ben Boeckel
09b7ac7f67 strings: use single characters where possible 2023-07-30 18:33:07 -04:00
Ben Boeckel
6aa9023700 string_view: use string_view literals in comparisons 2023-07-30 18:33:07 -04:00
Ben Boeckel
1b60137b98 strings: combine string literals 2023-07-30 18:33:07 -04:00
Ben Boeckel
e1b70d7286 cmCPackDragNDropGenerator: use a string instead of a stream for commands 2023-07-30 18:33:07 -04:00
Ben Boeckel
f5d04b5bf0 cmStrCat: use where possible in Apple-specific sources 2023-07-30 18:33:07 -04:00
Ben Boeckel
ce549909fb cmCPackPKGGenerator: remove unnecessary .c_str() calls 2023-07-30 18:33:07 -04:00
Ben Boeckel
e48dbbf048 cmCPackDragNDropGenerator: remove unnecessary string construction 2023-07-30 18:33:07 -04:00
Ben Boeckel
084aa40ecb clang-tidy: fix modernize-loop-convert lints 2023-07-30 18:33:07 -04:00
Ben Boeckel
ffa49c23aa clang-tidy: fix readability-else-after-return lints 2023-07-27 20:15:51 -04:00
Ben Boeckel
4489e9a85c clang-tidy: fix modernize-use-auto lints 2023-07-27 20:15:51 -04:00