Commit Graph

1170 Commits

Author SHA1 Message Date
Brad King
5d700abda4 Source: Simplify FindProgram calls
Remove defaulted arguments.  Remove unnecessary `.c_str()`.
2025-04-07 19:55:30 -04: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
Nikita Nemkin
7c825fd15f cpack: Respect CPACK_ARCHIVE_FILE_NAME for non-component packages
The variable CPACK_ARCHIVE_FILE_NAME (added in 9e06e97d30)
only works if per-component packaging is enabled. This isn't obvious
from the documentation.

Make it also work for non-component packages and adjust documentation.

Fixes: #8769
2025-02-04 20:36:10 +05:00
Johnny Jazeix
09d5a4d7f0 CPack: add uncompressed TAR support
Fixes: #26646
2025-01-31 10:11:32 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Kitware Robot
b2ba64add9 Revise C++ coding style using clang-format-18
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`.  Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Fixes: #26123
2025-01-23 11:43:06 -05:00
Alex Turbov
c3777c1536 ci: Extend spellcheck job with 'typos' tool
Unlike the `codespell`, `typos` is capable of finding typos
in combined identifiers (`CamelCase` or `snake_case`).
2025-01-22 08:51:45 -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
f3f70c2f90 StringAlgorithms: Refactor cmTokenize() function
- Refactor and optimize the loop to make it shorter and faster
- Make it push elements into an arbitrary (templated) output iterator
- Make it a template on a separator type with the most used defaults
- Add a backward compatible signature to return `std::vector<std::string>`
- Add an alternative function `cmTokenizedView()` to return a vector of string views
2024-11-06 18:42:17 +04:00
Vitaly Stakhovsky
17ee28728b cmCPackGenerator: Add GetOptionIfSet() to avoid duplicate calls 2024-11-04 12:59:15 -05:00
Brad King
5aed3ee49d cmSystemTools: Add GetLogicalWorkingDirectory
Track the current working directory with symbolic links preserved.
2024-11-03 08:26:36 -05:00
Brad King
bd51803761 Merge topic 'misc-refactoring'
788e5c1043 Tests: Add tests for `cmDocumentationFormatter::PrintFormatted()`
8c1a850c19 cmMessenger: Deduplicate `cmSystemTools::Message()` calls
9c118ae9d4 Refactor: `cmCPackGenerator::DisplayVerboseOutput()` unused arg
5fd795f975 MessageType: Add `UNDEFINED` enum item
a6cae9dbc4 cmMessageCommand: Rename+move `CheckingType` → `Message::CheckType`
bb9071e9e7 cmDocumentationFormatter.cxx: Move padding string creation out of loop
f40712fc10 cmTargetLinkLibrariesCommand: Optimize `ostream::operator<<` calls
1ffb746c92 cmGlobalGenerator.cxx: Optimize `ostream::operator<<` calls
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9920
2024-10-24 09:00:32 -04:00
Brad King
063e98eb4b Merge topic 'normalize-input-paths'
ee83165923 cmake: Explicitly normalize input paths as they exist on disk
9d44a77454 find_*: Explicitly normalize found paths as they exist on disk
967d3ea85c cmake-gui: Explicitly normalize input paths as they exist on disk
074ad98ebc ctest: Explicitly normalize input paths as they exist on disk
1f14238701 cpack: Explicitly normalize input paths as they exist on disk
9fe09ebc53 cmSystemTools: Add GetEnvPathNormalized to get paths from environment
2108f3507f cmSystemTools: Add SplitEnvPathNormalized to split paths from environment
6d57403e14 cmSystemTools: Fix SplitEnvPath to avoid empty paths
...

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9929
2024-10-23 08:30:35 -04:00
Brad King
1f14238701 cpack: Explicitly normalize input paths as they exist on disk 2024-10-22 13:24:46 -04:00
Alex Turbov
9c118ae9d4 Refactor: cmCPackGenerator::DisplayVerboseOutput() unused arg 2024-10-22 01:06:30 +04:00
leha-bot
e7371f5a18 cpack: Allow -D flag to be used without separator
`cmake` and `ctest` already accept `-Dvar=value`.

Fixes: #26394
2024-10-21 16:31:04 -04:00
Daniel Pfeifer
281e9039cb cmWorkingDirectory: Unify error messages 2024-10-18 15:04:07 -04:00
Julien Marrec
3331c7032f CPack/IFW: Add option for ProductImages URLs
Add a `CPACK_IFW_PACKAGE_PRODUCT_IMAGE_URLS` variable for them.
2024-09-11 08:44:09 -04:00
Julien Marrec
d58f90f628 CPack/IFW: Actually ignore missing ProductImages 2024-09-11 08:10:52 -04:00
Julien Marrec
3c214f2638 CPack/IFW: Fix generation of ProductImages
Entries of `CPACK_IFW_PACKAGE_PRODUCT_IMAGES` each need their own
`ProductImage element.

Fixes: #26268
2024-09-10 14:31:47 +02:00
Vitaly Stakhovsky
58da4aa47d Source: Avoid comparing pointers to nullptr 2024-08-27 10:56:38 -04:00
Brad King
d81a2e4f5e Merge topic 'cpack-pkg-c_str'
1393b31635 cmCPackPKGGenerator: Remove redundant call to c_str

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9759
2024-08-21 08:54:14 -04:00
Rose
1393b31635 cmCPackPKGGenerator: Remove redundant call to c_str
The call is unnecessary since commit 438809d3ba (cmCPackGenerator: Add
option to FindTemplate to use alternate builtin path, 2024-03-06,
v3.30.0-rc1~353^2~4).
2024-08-20 11:58:28 -04:00
Brad King
be881e89a8 Merge topic 'optimize-stream-shift-operators'
5b259985bf Refactor: Optimize some `std::ostream::operator<<()` calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9717
2024-08-20 11:51:10 -04:00
Brad King
4522a01192 Merge topic 'cpack-nsis-reserved-component-names'
b1f956529a CPack/NSIS: Fix matching of reserved component names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9757
2024-08-20 11:17:59 -04:00
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
Alex Turbov
5b259985bf Refactor: Optimize some std::ostream::operator<<() calls 2024-08-19 19:42:31 +04:00
Brad King
0d52257afa Merge topic 'cpack-external-partial-json'
ab26d334bf cmCPackExternalGenerator: ensure JSON is written before running the script

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9669
2024-07-23 09:51:14 -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
Robert Schuster
55524c48a4 CPack/DEB: Add Multi-Arch support
Add support for Multi-Arch in control files of Debian packages.
Valid values: same, foreign, allowed

Fixes: #21445
2024-06-21 12:27:50 -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