cmake: Adjust macOS SDK detection#11893
Merged
Merged
Conversation
PatTheMav
reviewed
Mar 5, 2025
jcm93
force-pushed
the
fix/mac-sdk
branch
4 times, most recently
from
March 15, 2025 05:42
8404301 to
858a72c
Compare
PatTheMav
reviewed
Mar 17, 2025
PatTheMav
approved these changes
Mar 21, 2025
PatTheMav
left a comment
Member
There was a problem hiding this comment.
Looks good to me - errors for missing Xcode installation or missing versions are correctly caught and appropriate error messages shown.
RytoEX
approved these changes
Mar 31, 2025
This was referenced Apr 23, 2025
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Adjust the macOS CMake initialization logic to use
xcrunto derive our SDK version information, rather than relying on the presence of${CMAKE_OSX_SYSROOT}.Motivation and Context
CMake 4.0.0 (currently in the release candidate phase) breaks OBS configuration/generation on macOS. This is because CMake 4.0.0 no longer defines
CMAKE_OSX_SYSROOTby default for macOS builds, which we currently rely on to make sure the user has an SDK supported by OBS.This CMake change was apparently made because specifying
CMAKE_OSX_SYSROOTseems to translate under the hood to passing-isysrootto the compiler, which apparently had some undesired impacts in some situations (further context here and here). Letting the compiler wrapper figure out its sysroot on its own seems to now be the preferred pattern.As we would still like to check what SDK version the user has installed, we can just derive it ourselves using
xcrunto populate a variable with the user's environment's currently configured SDK path. This way we can make sure that the user has an SDK version we support, while still letting CMake not define a sysroot.How Has This Been Tested?
Installed CMake 4.0.0 rc1 and configured/generated/built OBS successfully; also made sure configuration/generation/building proceeded successfully on CMake 3.31.4.
Types of changes
Checklist: