Commit Graph

1463 Commits

Author SHA1 Message Date
Brad King
576abb42cf Merge topic 'linker-configuration-haiku' into release-4.0
379785e869 Linker configuration: Add missing platform Haiku

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10318
2025-02-10 16:16:20 -05:00
Begasus
379785e869 Linker configuration: Add missing platform Haiku
Add Haiku information modules missed by commit c1c4cf9545 (Linker
configuration: introduce a new architecture, 2024-06-05,
v3.31.0-rc1~307^2~1).
2025-02-10 10:27:27 -05:00
Aditya Vidyadhar Kamath
ff03db6657 AIX: Add platform id variables 'AIX' and 'CMAKE_HOST_AIX'
This allows projects to use `if(AIX)` blocks instead of spelling
out `if(CMAKE_SYSTEM_NAME STREQUAL "AIX")`.  We already have similar
variables for many other platforms.
2025-02-07 11:10:43 -05:00
Brad King
ee35812ddf Merge topic 'fix-swift-whole-archive'
c894bc0831 Linker: Restore support for WHOLE_ARCHIVE with Swift libraries

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10266
2025-02-04 08:47:56 -05:00
Alexandra Cherdantseva
c894bc0831 Linker: Restore support for WHOLE_ARCHIVE with Swift libraries
Add Swift linker information modules missed by commit c1c4cf9545 (Linker
configuration: introduce a new architecture, 2024-06-05,
v3.31.0-rc1~307^2~1) and needed since commit 1e35163ae8 (WHOLE_ARCHIVE
link feature: rely now on linker configuration, 2024-07-01,
v3.31.0-rc1~307^2).

Fixes: #26657
2025-02-03 10:32:34 -05:00
Brad King
3e64c6a56e Merge topic 'msvc-runtime-checks'
2b2344b412 MSVC: Add abstraction for runtime checks
49dcd1ce5d Help: Fix MSVC_DEBUG_INFORMATION_FORMAT description of example
2f8e643d9d CMP0141: Fix documentation copied from CMP0091

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Alex <leha-bot@yandex.ru>
Merge-request: !10214
2025-01-30 08:48:01 -05:00
AJIOB
2b2344b412 MSVC: Add abstraction for runtime checks
Replace our hard-coded default for `/RTC1` with a first-class
abstraction to select runtime checks from an enumeration of logical
names.  Add a `MSVC_RUNTIME_CHECKS` target property and corresponding
`CMAKE_MSVC_RUNTIME_CHECKS` variable.

Removing the old default flag requires a policy because existing
projects may rely on string processing to edit them and choose
runtime checks under the old behavior.  Add policy CMP0184 to
provide compatibility.

Fixes: #26614
2025-01-29 13:07:41 -05:00
Peter Kokot
4e6a13f211 Use lower case style for commands
Where possible this syncs the CS for command names:

- check_c_source_compiles()
- check_cxx_compiler_flag()
- check_cxx_source_compiles()
- check_cxx_symbol_exists()
- check_include_file_cxx()
- check_include_file()
- check_include_files()
- check_library_exists()
- check_source_compiles()
- check_struct_has_member()
- check_symbol_exists()
- check_type_size()
- cmake_dependent_option()
- cmake_parse_arguments()
- feature_summary()
- file()
- find_package_handle_standard_args()
- if(), endif...
- install(FILES)
- list()
- message()
- pkg_check_modules()
- select_library_configurations()
- set_package_info()
- test_big_endian()
2025-01-28 13:51:46 -05:00
Peter Kokot
9f2efc3270 Remove optional arguments from else() and end*() commands
This adds a brief explanation of the optional condition in the `else()`
and removes all legacy usages of `else()` and `end*()` commands.
2025-01-28 03:01:23 +01:00
Marc Chevrier
3d2709c1ae Linker configuration: rely now on CMAKE_<LANG>_LINK_MODE variable.
CMake now provides the CMAKE_<LANG>_LINK_MODE variable which specify how
the link step is done. So, the CMAKE_<LANG>_USING_LINKER_MODE variable
is no longer needed.
2025-01-26 14:45:21 +01:00
Marc Chevrier
0ba67171d9 Extend CMAKE_<LANG>_LINK_MODE support
* Add CMAKE_Swift_LINK_MODE
* Ensure correct definition for various clang usages on Windows
2025-01-26 14:45:21 +01:00
Brad King
fb1bd1d330 CMP0065: Remove support for OLD behavior 2025-01-22 10:40:55 -05:00
Brad King
c283aafe62 CMP0057: Remove support for OLD behavior 2025-01-22 10:40:53 -05:00
Brad King
90d814f024 CMP0054: Remove support for OLD behavior 2025-01-20 09:46:55 -05:00
Brad King
4ecf57dcd9 Merge topic 'homebrew-prefix'
da07c8ad2a macOS: Detect homebrew prefix from brew tool

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10138
2025-01-15 09:38:17 -05:00
Alexander Grund
da07c8ad2a macOS: Detect homebrew prefix from brew tool
Although not recommended by homebrew, users can install it in a
non-standard prefix.  Ask `brew --prefix` before using defaults.
2025-01-14 10:47:25 -05:00
Brad King
72e27a4856 Merge topic 'fix-typos-found-by-pre-commit-hooks'
d620d77d26 FindDoxygen: Rename `_Doxygen_dne_header` -> `_Doxygen_do_not_edit_header`
e7ff3cccea PushToAndroidDevice.cmake: Rename `cmake_parse_arguments` prefix
bc8621d999 Fix: A lot of typos in code found by `typos`
b33beb7af5 Help: Fix some typos found by `sphinx-lint`
78e45c2db6 Style: Replace TABs with spaces for indentation in some files
74e0173f66 Tests(NuGet): Fix the test to ignore empty and space-only lines

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10151
2025-01-14 09:44:34 -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
Marc Chevrier
00932ea864 Introduce CMAKE_<LANG>_LINK_MODE variable.
This variable define how the link step is done. Possible values are:
* DRIVER: the compiler is used as driver for the link step
* LINKER: the linker is used directly for the link step.
2025-01-10 13:24:16 +01:00
Samuel Thibault
a47283801e hurd: Add GNU linker options
Fixes: #26518
2024-12-12 09:19:36 -05:00
Samuel Thibault
4d1066c578 hurd: Add more GNU options support 2024-12-11 20:18:56 +01:00
Samuel Thibault
0c452257e7 hurd: Add relative rpath support 2024-12-09 01:22:18 +01:00
Joseph Snyder
2709f07b4d VS: Add minimal support for Windows Kernel Mode Drivers
Extend the experimental support for `WindowsKernelModeDriver` to the
Visual Studio generators.  Hard-code some settings for now.
2024-12-03 14:18:52 -05:00
Marc Chevrier
a4ff2b01e3 IntelLLVM-Windows: add definitions for ARCHIVER: prefix
Configure ARCHIVER: prefix to enable the archive libraries management
with Windows-IntelLLVM.

Issue: #26300
2024-11-26 19:26:08 +01:00
Matthew Woehlke
99ac59d31b style: Remove trailing blank lines from all CMake sources
Our development workflow tooling prevents trailing blank lines
from being added, but some such lines remain from before that
was enforced.  Remove them to make it easier to rename files
without triggering enforcement.
2024-11-21 15:48:02 -05:00
Brad King
af3a48a591 Merge topic 'Linux-deduplication-static-libs'
0445190d2f LLD linker: avoid regression on archive libraries deduplication

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10010
2024-11-19 10:14:42 -05:00
Marc Chevrier
0445190d2f LLD linker: avoid regression on archive libraries deduplication
Due to a bug on LLD linker for ELF binaries, deduplication should
occur only if CMP0156 and CMP0179 are NEW.

Fixes: #26447
2024-11-18 21:02:50 +01:00
Brad King
79a83ddb08 Apple: Enable linking during iOS/tvOS/visionOS/watchOS toolchain inspection
Since commit 11da882a12 (Apple: Introduce separate system name for iOS,
tvOS, and watchOS, 2018-01-15, v3.14.0-rc1~14^2~1) our toolchain
inspection steps, like ABI detection, tell `try_compile` to use a
`STATIC_LIBRARY` instead of an `EXECUTABLE`.  This was needed at the
time to avoid codesign requirements.  However, commit d3a64c4e3f (Xcode:
Explicitly turn off signing in try_compile projects, 2020-07-16,
v3.19.0-rc1~483^2) introduced a more general solution to that problem.
Restore linking during toolchain inspection so that we can detect and
identify the linker.

Suggested-by: Marc Chevrier <marc.chevrier@gmail.com>
Fixes: #26443
2024-11-14 11:06:49 -05:00
Brad King
fe872cc98c Merge topic 'musl-linux-any'
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9991
2024-11-13 09:19:25 -05:00
Brad King
6a25904983 Merge topic 'musl-linux-any' into release-3.31
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9991
2024-11-13 09:19:23 -05:00
Brad King
8d652dc191 Merge topic 'WHOLE_ARCHIVE-various-systems'
d2997ab601 Linker configuration: Add missing platforms

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !9992
2024-11-13 09:17:25 -05:00
Timo Röhling
d8559ec92e Linux: Recognize multiarch directories for musl-linux-any
When bootstrapping Debian for musl-linux-any, the multiarch directories
are not found due to an overly-specific regular expression.

See https://bugs.debian.org/1085507 for the original bug report.
2024-11-12 10:47:40 -05:00
Marc Chevrier
d2997ab601 Linker configuration: Add missing platforms
The following platforms were missing:
* Android
* WindowsCE, WindowsPhone, WindowsStore and WindowsKernelModeDriver

And enhance various Apple platforms support (iOS, tvOS, etc...)

Fixes: #26439
2024-11-12 16:46:54 +01:00
Brad King
7b19531291 macOS: Do not pass any SDK/-isysroot to compilers by default
On modern macOS, compiler wrappers like `/usr/bin/cc` automatically
choose a SDK to pass via `-isysroot` to an underlying compiler from
Xcode or the CommandLineTools.  Other toolchains like Homebrew's `gcc-*`
come with a default SDK too.  Therefore, when targeting macOS, we no
longer need to choose any SDK or pass an `-isysroot` flag by default.

Update initialization of `CMAKE_OSX_SYSROOT` to be empty by default when
targeting macOS.

Fixes: #19180
2024-11-07 09:46:10 -05:00
Brad King
3b8b70fe72 macOS: Simplify logic converting CMAKE_OSX_SYSROOT to a path 2024-11-07 09:46:10 -05:00
Joseph Snyder
54bbd00448 WindowsKernelModeDriver: Switch to appending to variables
When using the WindowsKernelModeDriver, do not add the new paths
if the variable was not previously defined.  Instead, append them
to the existing value.

Add a new GUID for the Experimental mode gate
2024-10-24 13:20:08 -04:00
Brad King
9c5f6d22f3 Merge topic 'windows-kernel-mode-driver-includes'
b151bcfc9e WindowsKernelModeDriver: Add WDK include and link paths on MSVC

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9705
2024-09-05 09:21:35 -04:00
Joseph Snyder
b151bcfc9e WindowsKernelModeDriver: Add WDK include and link paths on MSVC
Detect Windows Kernel-Mode Driver include directories and library search
paths from the WDK command-line environment.  Require toolchain files to
specify the KMDF target version via a new variable.

Since this changes the behavior of the WindowsKernelModeDriver
experimental feature, update its UUID.
2024-09-03 11:10:35 -04:00
Rüdiger Ihle
09a47c7972 MSVC: Restore support for non-incremental linking with v100 toolset and older
Since commit 0b552eb877 (MSVC: Embed manifests directly for
non-incremental vs_link_exe links, 2023-02-20, v3.27.0-rc1~438^2) we use
`/MANIFEST:EMBED`, but that is not supported by older MSVC linkers.
Restore use of the standalone manifest tool.

Update `Tests/MSManifest` to recognize `dpiAwareness` in the manifest
content as written by MSVC v100 tooling.

Fixes: #26179
2024-09-03 10:58:28 -04:00
Brad King
7a3961cc94 Merge topic 'android-ndk-27'
24cd4ff844 Android: Fix build with NDK 27

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9766
2024-08-26 09:46:36 -04:00
Lars Schmertmann
24cd4ff844 Android: Fix build with NDK 27
`NDK_PROC_*_ABI` and `NDK_ARCH_*_ABI` were removed in the Android
NDK 27 but will be reintroduced in the Android NDK 27b:

* https://github.com/android/ndk/issues/2049
* https://android-review.googlesource.com/c/platform/ndk/+/3196345

Both are only used when `CMAKE_ANDROID_ARCH_ABI` is NOT given. But
currently the existence is also checked when `CMAKE_ANDROID_ARCH_ABI`
is given. So we move the checks to the position they are required.
2024-08-22 09:30:01 -04:00
Tudy Gourmelen
4b84596dcf Android: Fix condition detecting no APIs found in the NDK
Fixes: #26210
2024-08-14 08:16:24 +02:00
Marc Chevrier
1e35163ae8 WHOLE_ARCHIVE link feature: rely now on linker configuration
Fixes: #26019
2024-07-22 16:58:51 +02:00
Marc Chevrier
c1c4cf9545 Linker configuration: introduce a new architecture
A new set of files are dedicated to linker configuration.
This set of files enable a fine-tuned configuration based of the linker
type as identified during compiler detection.

Fixes: #25360
2024-07-20 19:05:54 +02:00
Brad King
a8d8f26828 Merge topic 'aix-archive-shared-libraries'
d27fe9dfba AIX: Add option to archive shared libraries
98013ad1ca cmXCOFF: Add support for editing binary inside an archive

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !9606
2024-07-19 09:55:58 -04:00
Aditya Vidyadhar Kamath
d27fe9dfba AIX: Add option to archive shared libraries
Add option `CMAKE_AIX_SHARED_LIBRARY_ARCHIVE`.

There will no versions for the shared objects when this option is used.

Closes: #26033
2024-07-17 11:52:09 -04:00
Brad King
25abc95715 Merge topic 'LLVMFlang-aix'
e37d8e28e8 LLVMFlang: Add support for AIX

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !9661
2024-07-17 09:48:24 -04:00
Kelvin Li
e37d8e28e8 LLVMFlang: Add support for AIX 2024-07-16 14:32:19 -04:00
Jacob Hummer
68cd5281e4 WASI: Add platform modules
Add minimal platform modules to support toolchain files like those in

* https://github.com/WebAssembly/wasi-sdk

or direct use of `-DCMAKE_SYSTEM_NAME="WASI"`

Fixes: #19223
2024-07-16 12:28:19 -04:00
moyo1997
b2a2865205 MSVC: Remove outdated preprocessor flags for targeting ARM64EC
Remove `/DAMD64` and `/DARM64EC` flags added by commit 4ea3a88625 (MSVC:
Add support for targeting ARM64EC, 2020-12-30, v3.20.0-rc1~121^2) that
are not longer expected.
2024-07-09 14:21:21 -04:00