Skip to content

Pin CMAKE_OSX_DEPLOYMENT_TARGET so the macOS floor is deliberate - #2575

Open
ZayanKhan-12 wants to merge 1 commit into
SCIInstitute:masterfrom
ZayanKhan-12:pin-osx-deployment-target
Open

Pin CMAKE_OSX_DEPLOYMENT_TARGET so the macOS floor is deliberate#2575
ZayanKhan-12 wants to merge 1 commit into
SCIInstitute:masterfrom
ZayanKhan-12:pin-osx-deployment-target

Conversation

@ZayanKhan-12

Copy link
Copy Markdown

Fixes #2565.

Nothing in the build set CMAKE_OSX_DEPLOYMENT_TARGET, so the macOS floor of every binary was an accident of the build machine's OS/SDK, and post-floor symbols linked cleanly but failed at load time on older Macs — #2564 (quick_exit) was one instance.

What this does

  • Defaults the floor to 14.0 (the oldest macOS in the CI matrix), as a user-overridable cache variable set before the first PROJECT() call in both Superbuild/CMakeLists.txt and src/CMakeLists.txt. Guarded on CMAKE_HOST_APPLE (the target APPLE var doesn't exist before project()); ignored off-Apple.
  • Forwards it explicitly to every compiled ExternalProject, since ExternalProject sub-builds do not inherit it:
    • CMake-configured externals (Zlib, SQLite, Teem, Freetype, Cleaver2, LodePng, Tny, Qwt, Tetgen, Ospray) get a cache/args entry mirroring the existing CMAKE_BUILD_TYPE forwarding.
    • Boost: the real compile happens in the build_libs b2 step, so b2 additionally gets cxxflags=/linkflags=-mmacosx-version-min=….
    • CPython: MACOSX_DEPLOYMENT_TARGET is set in the configure env; configure bakes it into its Makefile so the build steps inherit it.
    • Header-only externals (Eigen, GLM, SpdLog) and WIN32-only Glew unchanged. GoogleTestExternal.cmake is not referenced by the Superbuild, so it was left alone.
  • Adds -Wunguarded-availability-new to the APPLE warning set in SCIRUN_ADD_LIBRARY, so availability-annotated post-floor API use is a compile-time warning instead of a runtime dyld failure. (Honest caveat: it would not have caught quick_exit, which the 15 SDK declares without availability annotations — but with the pin, __MAC_OS_X_VERSION_MIN_REQUIRED now reads 140000 deterministically, which is what makes Fix dyld crash on macOS < 15 from unguarded quick_exit reference #2564's guard reliable.)
  • Adds a macOS CI step asserting the built binary's LC_BUILD_VERSION minos equals the pin, so a dropped flag shows up as a red build rather than a user crash report.

Verification

  • Superbuild configure run locally (Apple Silicon, CMake 4.3): CMAKE_OSX_DEPLOYMENT_TARGET:STRING=14.0 lands in the top-level cache and in every generated Externals/tmp/<name>_external-cache-Release.cmake plus Tetgen's configure command.
  • The new CI otool step verifies the end-to-end result on the macOS PR job.

Note: touches the same ExternalProject_Add blocks as the superbuild-caching residue on #2513 — happy to rebase whichever lands second.

…Institute#2565)

Nothing in the build set CMAKE_OSX_DEPLOYMENT_TARGET, so the deployment
target of every binary defaulted to the OS/SDK of whichever machine ran
the build, and symbols newer than that accidental floor linked cleanly
but died at load time on older Macs (SCIInstitute#2564 was one instance).

- Default the floor to 14.0 (oldest macOS in the CI matrix) as a cache
  variable set before the first PROJECT() call in both the Superbuild
  and src/ entry points; user-overridable, ignored off-Apple.
- Forward it explicitly to every compiled ExternalProject: ExternalProject
  sub-builds do not inherit it. CMake-configured externals get a cache/arg
  entry; Boost additionally passes -mmacosx-version-min to the real b2
  compile; CPython gets MACOSX_DEPLOYMENT_TARGET in its configure env,
  which configure bakes into its Makefile.
- Add -Wunguarded-availability-new on APPLE so annotated post-floor API
  use fails loudly at compile time instead of at dyld load time.
- Add a macOS CI step asserting the built binary's LC_BUILD_VERSION
  minos equals the pin, so a dropped flag is a red build, not a user
  crash report.

Header-only externals (Eigen, GLM, SpdLog) and the WIN32-only Glew are
unchanged; GoogleTestExternal.cmake is not referenced by the Superbuild.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dcwhite
dcwhite requested review from dcwhite and jessdtate July 25, 2026 23:43
@dcwhite

dcwhite commented Jul 25, 2026

Copy link
Copy Markdown
Member

I'll have to examine this one carefully (not just with Claude 😉 )

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.

Pin CMAKE_OSX_DEPLOYMENT_TARGET so one build runs on older macOS

3 participants