cmake: adjust defaults for target platforms not supporting shared libs #19420
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If CMake reports the target platform not supporting shared libs, turn
BUILD_SHARED_LIBSoff by default. CMake 3.30+ fails with an errorwhen trying to create a
SHAREDtarget for such platforms. Earlierversions used a workaround that may or may not have worked in practice.
Ref: https://cmake.org/cmake/help/v3.30/policy/CMP0164.html
Seen this with a build setting
-DCMAKE_SYSTEM_NAME=Generic, e.g.AmigaOS.
Note this may introduce incompatibility for "Generic" targets, which
support shared libs. If that's the case, set
BUILD_SHARED_LIBS=ONmanually.
Also drop AmigaOS-specific logic handled automatically after this patch.
Ref: https://cmake.org/cmake/help/v3.7/command/get_property.html
Ref: https://cmake.org/cmake/help/v3.7/prop_gbl/TARGET_SUPPORTS_SHARED_LIBS.html
CMake built-in targets potentially affected as of today: