Skip to content

[CMake] Set CMAKE_OSX_SYSROOT only if CMake generator is Xcode #19218

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guitargeek
Copy link
Contributor

Set CMAKE_OSX_SYSROOT only if CMake generator is Xcode, because otherwise we don't need it. Also, if not using Xcode ,the xcrun executable that is used to figure out this variable is also not available, leading to configuration failures when building ROOT on macOS without Xcode installed.

Follows up on 6bd0dba and ebc38bd.

Set `CMAKE_OSX_SYSROOT` only if CMake generator is Xcode, because
otherwise we don't need it. Also, if not using Xcode ,the `xcrun`
executable that is used to figure out this variable is also not
available, leading to configuration failues when building ROOT on macOS
without Xcode installed.

Follows up on 6bd0dba and ebc38bd.
@guitargeek guitargeek self-assigned this Jun 27, 2025
@guitargeek guitargeek requested a review from bellenot as a code owner June 27, 2025 15:55
@guitargeek guitargeek added in:Build System clean build Ask CI to do non-incremental build on PR labels Jun 27, 2025
@@ -12,7 +12,7 @@ if(WIN32)
cmake_policy(SET CMP0091 OLD)
set(CMAKE_SKIP_TEST_ALL_DEPENDENCY TRUE)
endif()
if(APPLE AND (NOT CMAKE_OSX_SYSROOT OR CMAKE_OSX_SYSROOT STREQUAL ""))
if((CMAKE_GENERATOR MATCHES Xcode) AND (NOT CMAKE_OSX_SYSROOT OR CMAKE_OSX_SYSROOT STREQUAL ""))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it really dependent of the Generator or is it the compiler (XCode's clang)? (eg I use Ninja+XCode's clang).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, but you have the perfect setup to figure this out then! Does this PR build for you? If not, it's the compiler and I need to put a check for Apple Clang there. Can you give a hand by doing this check?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So form a fresh directory, with your commit, it seems to work ... but then again it is still 'set':

mac-142865:osxroot pcanal$ rg -C3 CMAKE_OSX_SYSROOT CMakeCache.txt 
475-
476-//The product will be built against the headers and libraries located
477-// inside the indicated SDK.
478:CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.5.sdk
479-

Copy link

Test Results

    20 files      20 suites   3d 5h 31m 57s ⏱️
 3 063 tests  2 718 ✅   0 💤 345 ❌
59 670 runs  59 215 ✅ 110 💤 345 ❌

For more details on these failures, see this check.

Results for commit bb1035d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean build Ask CI to do non-incremental build on PR in:Build System
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants