Commit Graph
312 Commits
Author SHA1 Message Date
Alex Turbov da9a8a3fbe CPack/DEB: Fix regression when package architecture is explicitly specified
Since commit 302a645d73 (CPack/DEB: use `triggers` instead of legacy
postXXX scripts for `ldconfig`, 2026-03-05, v4.4.0-rc1~583^2) the
`triggers` feature refers to `DPKG_EXECUTABLE` if the latter is defined.
Unfortunately, it is defined only if one particular execution branch has
executed.  Move the `find_program(dpkg)` to the function scope to make
it available in all execution branches.
2026-07-30 12:28:11 -04:00
Matthew Woehlke 7644d557df Check*: Refactor variable handling
Commit 5abaf65154 (Check*: Restore toleration of `;-W...` in
CMAKE_REQUIRED_FLAGS, 2026-06-24, v4.4.0-rc3~2^2) introduced logic to
prevent `-W*` arguments in `CMAKE_REQUIRED_FLAGS` from being passed as
CMake arguments. It was never the intent of `CMAKE_REQUIRED_FLAGS` to
support such usage; however, since older versions of CMake would
silently accept such arguments, some users were unintentionally passing
compiler warnings as CMake arguments. Although this usage is incorrect,
it was silently tolerated until CMake 4.4, which began treating unknown
`-W*` as an error.

Because it turns out that modules besides `CheckSource{Compiles,Runs}`
are affected, we are going to need the logic added by that commit in
many more places. As a first step toward accommodating that need, move
the logic to a new internal helper. While we're at it, try to generally
consolidate the common logic for handling the various variables that the
`Check*` family of modules uses for injecting arguments into the
ultimate `try_compile` calls.
2026-07-21 15:21:42 -04:00
Matthew Woehlke 5abaf65154 Check*: Restore toleration of ;-W... in CMAKE_REQUIRED_FLAGS
The `CMAKE_REQUIRED_FLAGS` variable, used by the various entry points to
`cmake_check_source_{compiles,runs}`, specifies that flags shall not be
separated by semicolons. This is because the way in which it is passed
to the child `cmake` process means that, when considered as a list (with
semicolon separated items), only the first item is actually used as
compile flags, with any additional items actually seen as arguments to
the child `cmake` process. While this usage is unsupported, if invoked
accidentally, flags starting with `-W` were silently ignored by CMake.

However, CMake 4.4 newly complains about unrecognized warning
categories, which means that uses which were silently broken now result
in a hard error.

In the longer term, it would be helpful to introduce a policy to repair
improper use of semicolons in `CMAKE_REQUIRED_FLAGS` in order to do what
the user probably meant. However, for various reasons, we do not want to
introduce a policy to CMake 4.4 at this time, and anyway, the policy
won't help users that haven't enabled it. Therefore, alter the 'check
source' functions to detect arguments being passed to `cmake` rather
than the compiler, and remove any such that start with `-W`. This
removes any arguments that newly cause errors starting with CMake 4.4,
while not otherwise altering behavior in case any users were abusing
this implementation quirk.

Strictly speaking, this means that users can no longer abuse this quirk
to alter CMake's diagnostics. However, the only case in which this
should be observable is if the user is already abusing the quirk to
inject their own CMake logic into the CMake-provided test projects.
Since this was never supported, anyone doing that can keep the pieces.

Issue: #27901
Fixes: #27893
2026-06-24 13:59:11 -04:00
scivision 7406f0be82 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
Capture `execute_process` calls' `RESULT_VARIABLE`.

We don't actually need to check the result as we presume the existing
logic is already adequate, and sometimes programs return non-zero values
as result of valid query.  I.e. this is a "safe" way to broadly protect
these scripts.

Issue: #27782
2026-05-07 13:36:36 -04:00
Brad King 57a1945745 Merge topic 'exe-check'
8d48d755f0 Tests: Add missing execute_process result checks
a1b5c0da87 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
6b4432bc10 FindGit: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !12011
2026-05-07 08:07:07 -04:00
scivision a1b5c0da87 Modules: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL
Capture the `execute_process` command's `RESULT_VARIABLE`.

Issue: #27782
2026-05-06 11:16:36 -04:00
Ben Boeckel 2e549c1df4 CMakeDetermineLinkerId: support the OpenWatcom linker ID 2026-05-05 12:24:59 -04:00
Brad King 811bf8fb89 Merge topic 'LINKER_TYPE-wild'
e96c5ba13d Add the support of the wild linker

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11966
2026-04-24 09:16:32 -04:00
Marc Chevrier e96c5ba13d Add the support of the wild linker
Fixes: #27755
2026-04-23 16:21:30 +02:00
Brad KingandSerguei E. Leontiev a95fae2d36 PellesC: Add support for ASM_POASM language assembler
The Pelles C compiler does not support ASM, and the `poasm` assembler
uses a distinct syntax.  Add a dedicated language as we do for similar
cases from other vendors.  Leave documentation commented out for now
because the PellesC toolchain support in general is not yet documented.

Fixes: #27758
Issue: #21536
Co-authored-by: Serguei E. Leontiev <leo@sai.msu.ru>
2026-04-22 14:42:00 -04:00
Brad King 0afca0c1e0 Merge topic 'CPACK_RPM_SPEC_MORE_DEFINE-list2string'
30aa150c25 CPack/RPM: `CPACK_RPM_SPEC_MORE_DEFINE` could be a list

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11899
2026-04-14 09:53:55 -04:00
Ben Boeckel 80abf737cc Modules: use find_*(NO_CACHE)
Avoid manual cache management logic.
2026-04-12 08:02:28 -04:00
Alex Turbov 30aa150c25 CPack/RPM: CPACK_RPM_SPEC_MORE_DEFINE could be a list
Signed-off-by: Alex Turbov <i.zaufi@gmail.com>
2026-04-12 05:54:58 +04:00
Alex Turbov 1f939db3c4 CPack/RPM: Remove superfluous %clean section from generated spec file
According to [this] commit message in the `rpmlint` codebase,
a %clean section is not necessary since `rpm` 4.8.0 (2010)
and nowadays `rpmlint` at least issues a warning about it, and
(seems) in some distros it's even considered as an error.

[this]: https://github.com/rpm-software-management/rpmlint/commit/b1a8a422
2026-03-08 03:52:21 +04:00
Alex Turbov 302a645d73 CPack/DEB: use triggers instead of legacy postXXX scripts for ldconfig 2026-03-05 23:14:10 +04:00
Alex Turbov f461382d42 CPack/DEB: rename variable w/ result of dpkg find to match other vars 2026-03-05 22:07:58 +04:00
Alex Turbov 8a8bceda98 CPack/DEB: rename internal variable 2026-03-05 22:06:12 +04:00
Alex Turbov 430eb26511 CPack/DEB: modernize parent scope variables pass 2026-03-04 21:29:45 +04:00
Alex Turbov 165889e7d2 CPack/DEB: refactor some functions to check for errors+exit earlier
… and deindent the rest of the function body.
2026-03-04 21:29:45 +04:00
Alex Turbov ed04dda2a2 CPack/DEB: wrap too long lines 2026-03-04 21:29:45 +04:00
Alex Turbov 6978f9591c CPack/DEB: remove redundant quotes and variable expansions 2026-03-04 21:29:44 +04:00
Alex Turbov 4c889716fa CPack/DEB: modernize filesystem operations 2026-03-04 20:31:50 +04:00
Alex Turbov 963a022782 CPack/RPM: wrap some too long lines 2026-03-03 21:42:47 +04:00
Alex Turbov 17a39084c2 CPack/RPM: some other simplifications 2026-03-03 21:42:47 +04:00
Alex Turbov 0966151c73 CPack/RPM: modernize file and path operations 2026-03-03 21:42:47 +04:00
Alex Turbov 16407d6934 CPack/RPM: escape regex in the modern way 2026-03-03 21:42:46 +04:00
Alex Turbov 9ed6106a27 CPack/RPM: remove redundant quotes and variable expansions 2026-03-03 21:42:38 +04:00
Alex Turbov d7701b758b CPack/RPM: use list transform instead of string manipulations 2026-03-03 21:41:52 +04:00
Alex Turbov fd321c02c5 CPack/RPM: ls -la execution + parse → file(READ_SYMLINK) 2026-03-03 21:41:52 +04:00
Alex Turbov 8549727ff4 CPack/RPM: use the modern return(PROPAGATE…) 2026-03-03 21:41:52 +04:00
Alex Turbov 2fe2665541 CPack/RPM: execute stat to get permissions instead of ls -l
Ask `stat` to output only human-readable permissions and nothing else.
Secondly, simplify parsing algorithm. Instead of multiple regex matches
transform permissions into a list and split into groups.
2026-03-03 21:41:52 +04:00
Alex Turbov 6445447692 CPack/RPM: modernize foreach calls to use IN LISTS/ITEMS 2026-02-28 02:27:38 +04:00
Robert Maynard 37777a66e3 CUDA: Handle env variables that clash with nvcc magic keywords
On windows when you run `nvcc -v` all the env variables will
be printed before nvcc verbose output. This allows us to handle
the cases where env variable exists with the same name as a magic
nvcc keyword we parse
2026-02-14 15:54:46 -05:00
Tyler YankeeandBrad King 98f9874703 cmake: Add per-language link flags for all target types
Previously, `CMAKE_<LANG>_LINK_FLAGS` was an undocumented variable used
for linking executables only. Re-spell that variable mirroring the
existing spellings for shared and module libraries, and add policy
CMP0210 to preserve compatibility.

Then, repurpose `CMAKE_<LANG>_LINK_FLAGS` to provide a variable to be
used for per-language link flags for all target types, along with a
per-configuration variant. These are added to the `<LINK_FLAGS>` rule
placeholder in the generators.

Fixes: #21934
Relates: #25620

Co-authored-by: Brad King <brad.king@kitware.com>
2026-01-31 19:37:09 -05:00
Paulius Velesko 47c3e55d4a HIP: Add support for SPIR-V platform
Add `spirv` as a known value for `CMAKE_HIP_PLATFORM`.
Default `CMAKE_HIP_ARCHITECTURES` to `OFF` for `spirv`.

Fixes: #27410
2026-01-20 13:18:18 -05:00
AJIOB 0bca70968a CPack: support archive compression level
Fixes: #18117
2026-01-09 10:35:04 -05:00
Brad King 12be5c60ff Merge topic 'cpack-stgz-deref-symlinks'
ecbe5a8479 CPack/STGZ: Avoid replacing directory symlinks if possible

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11526
2025-12-18 10:37:58 -05:00
Brad King ecbe5a8479 CPack/STGZ: Avoid replacing directory symlinks if possible
When installing into a prefix with existing directory symlinks, tell
`tar` not to replace them with real directories from the package.

Fixes: #21119
2025-12-17 17:33:23 -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
Brad King 5ec87b2ba7 Emscripten: Provide CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID
Extend commit 96d9b94a98 (Emscripten: Add platform modules, 2025-05-16,
v4.2.0-rc1~607^2~3) to account for commit 7f0f382c55 (Provide
CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID on more compilers, 2025-03-24,
v4.1.0-rc1~499^2).

Fixes: #27425
2025-11-25 15:46:16 -05:00
Alex Turbov 2ca11db2e3 pre-commit: version bump typos hook plus fix found typos
Backport commit 8de02a14c8 (ci(pre-commit): version bump `typos` hook
plus fix found typos, 2025-10-23) to the CMake 4.2 release branch.
2025-10-30 17:43:16 -04:00
Tristan Daifuku 69e2f3f8ea Linker: Tolerate CMAKE_EXECUTE_PROCESS_COMMAND_ERROR_IS_FATAL set to ANY
Tolerate expected failures of linkers invoked via `execute_process`.
2025-10-20 11:58:46 -04:00
Daniel Pfeifer 3c7fee0d99 CPack/NSIS: Allow setting CRCCheck
Fixes: #27260
2025-09-24 19:30:27 +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
Brad King 993794f5f6 CheckCompilerFlag: Avoid matching parts of multiple messages
Diagnostic messages for unsupported flags appear on a single line.
Do not accidentally match unrelated messages across multiple lines.

Fixes: #27156
2025-09-08 11:16:09 -04:00
Brad King c196e024bd CheckCompilerFlag: Improve layout of message regex tables 2025-09-08 11:14:41 -04:00
Brad King 36673385bb CUDA: Improve error message when CMAKE_CUDA_ARCHITECTURES contains quotes
Closes: #27150
2025-08-20 10:47:02 -04:00
Verney7 cfbf0480ff Sunway: Add sw_64 support
``sw_64`` is a new RISC ISA, which is a bit like RISC-V.
2025-08-07 09:42:11 -04:00
Brad King 72ee13035d Merge topic 'cuda_13_support'
3ff777de12 CUDA: Update CUDA tests to handle CUDA 13 deprecations
bbf732525a CUDA: Add CUDA 13.0 support to 'all' and 'all-major' architecture tables

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11015
2025-08-05 09:58:01 -04:00
Brad King 91a94392b5 Merge topic 'cuda_ensure_arch_order'
8beb309b79 CUDA: Make sure CUDA architectures are in order

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11014
2025-08-05 09:55:48 -04:00