Commit Graph

1483 Commits

Author SHA1 Message Date
Brad King
67f86c7db8 Merge topic 'clang-macos-sdk'
bf1bb62e74 macOS: Restore support for LLVM/Clang without explicit CMAKE_OSX_SYSROOT

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10734
2025-05-03 10:02:18 -04:00
Brad King
bf1bb62e74 macOS: Restore support for LLVM/Clang without explicit CMAKE_OSX_SYSROOT
In commit 7b19531291 (macOS: Do not pass any SDK/-isysroot to compilers
by default, 2024-11-06, v4.0.0-rc1~511^2) we broke support for using
upstream LLVM/Clang to build for macOS because the compiler has no
default sysroot.  Handle empty `CMAKE_OSX_SYSROOT` with LLVM/Clang by
falling back to the macOS SDK reported by `xcrun --show-sdk-path` .

Fixes: #26863
2025-05-02 13:49:40 -04:00
Brad King
eb8facd396 macOS: Avoid relying on sw_vers when cross-compiling from another OS
We have a few code paths needed only to support builds hosted on
macOS 10.4.  Update the conditions to work when cross-compiling
to macOS from another platform.

Fixes: #26814
2025-04-28 08:53:01 -04:00
Brad King
476b2a386f macOS: Remove outdated condition for CMAKE_OSX_DEPLOYMENT_TARGET
Revert commit 2853326e7a (BUG: Only set CMAKE_OSX_DEPLOYMENT_TARGET on
Mac OSX 10.4 or later, 2009-01-27, v2.8.0~1169).  AFAIK no one is using
macOS versions older than 10.4 anymore.
2025-04-28 08:37:33 -04:00
Brad King
2d04de2532 Merge topic 'macos-usr-local-lib'
6e63080d39 macOS: Restore RPATH entry for libraries linked from /usr/local/lib
430174e65d CMakeDetermineCompilerABI: Comment implicit link directory exclusion

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10663
2025-04-16 09:38:29 -04:00
Brad King
6e63080d39 macOS: Restore RPATH entry for libraries linked from /usr/local/lib
Since commit 7b19531291 (macOS: Do not pass any SDK/-isysroot to
compilers by default, 2024-11-06, v4.0.0-rc1~511^2) our default
invocation of compilers targeting macOS no longer passes `-isysroot`.
Without that, Xcode's compilers search `-L/usr/local/lib` by default
even though the macOS dynamic loader does not.  Since `/usr/local/lib`
is not a fully-implemented implicit link directory, exclude it from our
detected `CMAKE_<LANG>_IMPLICIT_LINK_LIBRARIES` so that our generators
do not suppress `RPATH` entries for dependencies in that directory.

Fixes: #26867
2025-04-15 14:13:45 -04:00
Brad King
7bb7a6fb13 Merge topic 'android-riscv64'
201c3a491c Android: add support for riscv64-linux-android

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10622
2025-04-09 09:24:59 -04:00
Jia Yuan Lo
201c3a491c Android: add support for riscv64-linux-android 2025-04-03 23:05:24 +08:00
Peter Kokot
50e57aa4ca CMAKE_COMPILER_IS_*: Replace with CMAKE_<LANG>_COMPILER_ID
Variables such as CMAKE_COMPILER_IS_GNUCC are documented as
obsolete/deprecated and ideally shouldn't be used in the code anymore
to have clearer compiler identifications.

In the past QCC compiler was identified as GNU and also had this
variable set to 1 (see policy CMP0047).  Same still applies for LCC
compiler (see policy CMP0129).
2025-03-29 20:31:49 +01:00
Brad King
67ab580804 Windows/Clang: Fix indentation in platform information module 2025-03-24 12:22:25 -04:00
Brad King
c8f4ae9ccf Merge topic 'GNU-linker-pushpop_state-detection'
d5be7c7f31 Linker: Detect GNU push-state/pop-state flags more robustly
7b552b9a64 Linker: Save GNU push-/pop-state detection with compiler inspection results
a9b126b0da Linker: Save linker inspection results with compiler inspection results
3f5f2b2d49 Linker: Honor CMAKE_<LANG>_LINK_LIBRARY_USING_FEATURE_SUPPORTED when FALSE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10468
2025-03-21 08:07:16 -04:00
Brad King
8214004200 Merge topic 'GNU-linker-pushpop_state-detection' into release-4.0
d5be7c7f31 Linker: Detect GNU push-state/pop-state flags more robustly
7b552b9a64 Linker: Save GNU push-/pop-state detection with compiler inspection results
a9b126b0da Linker: Save linker inspection results with compiler inspection results
3f5f2b2d49 Linker: Honor CMAKE_<LANG>_LINK_LIBRARY_USING_FEATURE_SUPPORTED when FALSE

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10468
2025-03-21 08:07:13 -04:00
Marc Chevrier
d5be7c7f31 Linker: Detect GNU push-state/pop-state flags more robustly
Try actually passing them to the linker to see whether it complains.

Fixes: #26766
2025-03-20 11:00:02 -04:00
Marc Chevrier
7b552b9a64 Linker: Save GNU push-/pop-state detection with compiler inspection results
Previously we saved it in the cache, which:

* Persists even if a new version of CMake changes how the check works.
* Does not propagate to `try_compile` checks.
2025-03-20 11:00:02 -04:00
Brad King
20bb463acc Merge topic 'aix-export-tbss'
e9c772404b AIX: Consider tbss symbols in ExportImportList

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10486
2025-03-18 13:11:58 -04:00
Aditya Vidyadhar Kamath
e9c772404b AIX: Consider tbss symbols in ExportImportList
Export `tbss` (thread variable but part of `bss` section) variables, e.g.:

    [125]  m  0x00000010    .tbss    1 extern                   s2n_errno
    [126]  a4 0x00000004      0   0    CM      UL   -   -
2025-03-18 09:56:26 -04:00
Roger Leigh
99c8abed55 kFreeBSD: Remove support for obsolete platform
kFreeBSD is no longer maintained or supported and was never an
officially-supported release architecture for Debian.

Closes: #26742
2025-03-05 11:57:49 -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
Brad King
d1e0eb405f Merge topic 'linker-configuration-haiku'
379785e869 Linker configuration: Add missing platform Haiku

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10318
2025-02-10 16:16:22 -05:00
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