Skip to content

Fix macOS OpenGL3 detection with CMake 4.1 - #4804

Open
tandede wants to merge 1 commit into
bulletphysics:masterfrom
tandede:fix/cmake41-macos-opengl3
Open

Fix macOS OpenGL3 detection with CMake 4.1#4804
tandede wants to merge 1 commit into
bulletphysics:masterfrom
tandede:fix/cmake41-macos-opengl3

Conversation

@tandede

@tandede tandede commented Aug 24, 2026

Copy link
Copy Markdown

Problem

CMake 4.1 removed the private _CURRENT_OSX_VERSION variable 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 disables BUILD_OPENGL3_DEMOS and adds NO_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_TARGET variable 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:

  • the default empty deployment target keeps BUILD_OPENGL3_DEMOS=ON and does not define NO_OPENGL3;
  • an explicit 10.8 target sets the option to OFF and defines NO_OPENGL3;
  • an explicit 10.9 target keeps the option ON and does not define NO_OPENGL3.

The pre-fix baseline sets the option to OFF for the same default empty-target configuration.

Validation

  • Configured fresh default, macOS 10.8, and macOS 10.9 build trees with CMake 4.4.2.
  • Completed the default Clang 21 build: 967/967 build steps passed.
  • Confirmed that examples/ExampleBrowser/App_ExampleBrowser was linked successfully.
  • Ran git diff --check.

Fixes #4733.

@Snovve

Snovve commented Sep 4, 2026

Copy link
Copy Markdown

just download linux

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Misidentified macOS version during build of OpenGL3 demos

2 participants