Commit Graph

1190 Commits

Author SHA1 Message Date
Roberto Benfatto
865f0032eb CPack/DEB: Remove extra newline at the end of .deb control file
It effectively created a control file with two stanzas when package file
data is appended, one of which lacks required parameters, making this
package impossible to use in a package repository.

Fixes: #26975
2025-06-04 11:30:51 -04:00
Brad King
3bc68185b1 Merge topic 'cpack-DragNDrop-leaks'
07d9e9b5fe CPack/DragNDrop: Release CoreFoundation objects after they are used

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10830
2025-05-28 09:15:50 -04:00
AZero13
07d9e9b5fe CPack/DragNDrop: Release CoreFoundation objects after they are used
Otherwise we will be leaking memory.
2025-05-27 11:19:19 -04:00
AZero13
bbc98fb67a CPack/DragNDrop: Avoid crash when locale identifier creation fails
If `CFLocaleCreateCanonicalLanguageIdentifierFromString` fails, stop
gracefully.  Otherwise we crash because `CFStringGetCString` cannot work
with null `CFStrings`.
2025-05-27 11:09:55 -04:00
Brad King
f8cc68d282 Merge topic 'wix-include-build-dir'
900897b510 CPack/WiX: Add the build directory to IncludeSearchPaths for wix.exe
a86eaf98f7 CPack/WiX: Restore condition for passing build directory to candle search path

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10816
2025-05-24 07:15:35 -04:00
Julian Greilich
900897b510 CPack/WiX: Add the build directory to IncludeSearchPaths for wix.exe
In commit f2134169f6 (WiX: Add the build directory to IncludeSearchPaths
for candle.exe, 2018-07-06, v3.13.0-rc1~318^2) we implemented this for
WiX v3 with `candle.exe`.  Use the same mechanism for Wix v4 and upwards
for `wix.exe`.
2025-05-23 08:41:13 -04:00
Julian Greilich
a86eaf98f7 CPack/WiX: Restore condition for passing build directory to candle search path
Refactoring in commit 48adc29721 (replace "std::string::find(x) == 0"
with cmHasPrefix(), 2020-03-20, v3.18.0-rc1~488^2~7) accidentally
changed `std::string::rfind(x, 0) != 0` to `!cmHasSuffix()` instead of
`!cmHasPrefix()`.

This is currently not an big issue, but leads to the build directory
being included even when no source file outside the build directory is
used in the project.
2025-05-23 08:40:44 -04:00
Ben Boeckel
557c44b93e cmStrCat: use character literals where possible
Found and replaced using the `cmstrcat-to-char-literal` rule for
`ast-grep`.
2025-05-15 19:12:04 +02:00
Brad King
57b24e8fef StdIo: Init() automatically in Console()
Applications that initialize a `cm::StdIo::Console` immediately no
longer need to `cm::StdIo::Init` first.
2025-05-13 10:35:47 -04:00
Brad King
3e88020aed StdIo: Replace uses of KWSys ConsoleBuf with StdIo::Console
Issue: #26924
2025-05-13 10:35:47 -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
Vitaly Stakhovsky
e991145430 Source: Avoid duplicate calls 2025-04-29 06:51:28 -04:00
Brad King
cacd17230f Merge topic 'apple-CoreFoundation-headers'
d736dafa22 Merge branch 'backport-3.31-apple-CoreFoundation-headers'
42390e7aa2 Source: Include specific CoreFoundation headers instead of umbrella header
14ffd1cc4e cmXCodeObject: Drop unused CoreFoundation header

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10616
2025-04-09 09:08:38 -04:00
Brad King
d736dafa22 Merge branch 'backport-3.31-apple-CoreFoundation-headers' 2025-04-08 11:39:10 -04:00
Sergey Fedorov
42390e7aa2 Source: Include specific CoreFoundation headers instead of umbrella header
Some CoreFoundation headers included by the umbrella header, which we do
not need, use syntax that GCC does not support.  Avoid including them.

GCC-Issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115880
2025-04-08 11:38:24 -04:00
Brad King
8a3860379d Merge topic 'normalize-input-paths'
5805461074 cmSystemTools: Simplify call to FindProgram for our own executable
db0e2574cb cmSystemTools: Restore FindProgram look-up of on-disk case on Windows
5d700abda4 Source: Simplify FindProgram calls

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10620
2025-04-08 10:45:46 -04:00
Brad King
5d700abda4 Source: Simplify FindProgram calls
Remove defaulted arguments.  Remove unnecessary `.c_str()`.
2025-04-07 19:55:30 -04:00
Craig Scott
d289d720cb Help: Use consistent plural form for CPack configurations 2025-03-28 15:46:12 +11:00
Nikita Nemkin
2d9ae9de96 CPack: Allow source-relative CPACK_PROJECT_CONFIG_FILE
Resolve relative CPACK_PROJECT_CONFIG_FILE explicitly at config
generation time. Otherwise, it will be resolved at runtime
relative to the CPack execution directory (which could be anything).

Additionally, issue a warning if reading PACK_PROJECT_CONFIG_FILE
fails at runtime.

Fixes: #15522
2025-03-12 20:37:01 +05:00
Kitware Robot
1772622772 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 10:43:35 -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
Nikita Nemkin
d1f00444d1 CPack/NSIS: Avoid UNIX-style paths in macro variables
NSIS macro variables MUI_*_BITMAP require Windows-style paths.
Don't rely on the user and convert them explicitly.

For good measure, also convert the paths for MUI_PAGE_LICENSE,
MUI_ICON and MUI_UNIICON.

Note that NSIS scripts only require quotes for strings with spaces
and ConvertToWindowsOutputPath() handles this automatically.

Fixes: #9945
2025-02-14 18:47:14 +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