[all-commits] [llvm/llvm-project] f38770: [runtimes] Don't create shared library targets whe...
Matt Arsenault via All-commits
all-commits at lists.llvm.org
Mon Jun 22 09:29:12 PDT 2026
Branch: refs/heads/users/arsenm/runtimes-avoid-creating-shared-lib-unsupported-platform
Home: https://github.com/llvm/llvm-project
Commit: f38770a97bef318ab0387515dbb5c24b1fd5e8fe
https://github.com/llvm/llvm-project/commit/f38770a97bef318ab0387515dbb5c24b1fd5e8fe
Author: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: 2026-06-22 (Mon, 22 Jun 2026)
Changed paths:
M cmake/Modules/CMakePolicy.cmake
M libcxx/CMakeLists.txt
M libcxx/src/CMakeLists.txt
M libcxxabi/CMakeLists.txt
M libcxxabi/src/CMakeLists.txt
M libunwind/CMakeLists.txt
M libunwind/src/CMakeLists.txt
Log Message:
-----------
[runtimes] Don't create shared library targets when unsupported
On platforms that don't support shared libraries (e.g. CMAKE_SYSTEM_NAME of
"Generic", used for GPU and other baremetal targets), CMake's
Platform/Generic.cmake sets the global TARGET_SUPPORTS_SHARED_LIBS property to
FALSE. Under CMP0164's OLD behavior (the default, since the runtimes set
cmake_minimum_required(3.20)), CMake silently demotes SHARED library targets to
STATIC archives. libcxx, libcxxabi and libunwind always create their shared
target, so after demotion both the shared and static targets emit e.g.
"libc++abi.a" and Ninja fails with "multiple rules generate ...".
Rather than papering over the collision with a distinct output name, skip
creating the shared library targets entirely when the platform does not support
them, gating on the TARGET_SUPPORTS_SHARED_LIBS property (left undefined on
platforms that do support shared libraries). The few consumers of the shared
targets are guarded with TARGET checks so they fall back to the static library
or are skipped.
Also set policy CMP0164 to NEW so that any future unguarded
add_library(... SHARED ...) on an unsupported platform fails at configure time
instead of silently producing a colliding static archive.
See https://gitlab.kitware.com/cmake/cmake/-/issues/25759.
This was mostly AI generated with some comment and indentation fixups. Most of the
diff is just reindenting new conditions. The original generated diff did not
re-indent and was much smaller.
Co-Authored-By: Claude <noreply at anthropic.com>
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list