Fix macOS OpenGL3 detection with CMake 4.1 - #4804
Open
tandede wants to merge 1 commit into
Open
Conversation
|
just download linux |
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.
Problem
CMake 4.1 removed the private
_CURRENT_OSX_VERSIONvariable used by Bullet's macOS OpenGL3 check. When the variable is undefined, its empty value compares as earlier than 10.9, so a default modern macOS configuration disablesBUILD_OPENGL3_DEMOSand addsNO_OPENGL3.This prevents the Example Browser from using OpenGL3 even though the active compiler and SDK support it.
Approach
The relevant compatibility boundary is the minimum macOS version targeted by the generated binaries, rather than the host's Darwin kernel version or another private CMake implementation variable.
Use the public
CMAKE_OSX_DEPLOYMENT_TARGETvariable and enter the legacy path only when the user explicitly requests a target earlier than 10.9. When no deployment target is specified, leave the option at its normal default and let the selected compiler and SDK determine the effective target.This also preserves the existing behavior for explicit legacy targets without introducing another dependency on private CMake state.
Result
With CMake 4.4.2:
BUILD_OPENGL3_DEMOS=ONand does not defineNO_OPENGL3;10.8target sets the option toOFFand definesNO_OPENGL3;10.9target keeps the optionONand does not defineNO_OPENGL3.The pre-fix baseline sets the option to
OFFfor the same default empty-target configuration.Validation
examples/ExampleBrowser/App_ExampleBrowserwas linked successfully.git diff --check.Fixes #4733.