Skip to content
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

Fix setting of CMAKE_SYSTEM_NAME #205

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

Conversation

EduMenges
Copy link

As stated on CMake's documentation:

This variable will be set to true by CMake if the CMAKE_SYSTEM_NAME variable has been set manually (i.e. in a toolchain file or as a cache entry from the cmake command line).

This is problematic when building on a mac for a mac because CMAKE_CROSSCOMPILING will be enabled, causing wonky behavior when building projects that relies on this variable, such as gRPC.

By firstly assigning the CMAKE_SYSTEM_NAME to a variable and checking it against CMAKE_HOST_SYSTEM_NAME, we prevent this behavior and CMAKE_CROSSCOMPILING will only be set when it is actually necessary.

@EduMenges
Copy link
Author

There is an issue I've noticed tho, when compiling for a different architecture. CMAKE_SYSTEM_NAME wouldn't get replaced when an x86_64 mac is trying to compile for an aarch64 mac, which wouldn't turn CMAKE_CROSSCOMPILING on (I think?).
I could add an extra check, but it seems more of a workaround than a definite solution.

@leetal
Copy link
Owner

leetal commented Jul 18, 2024

Please rebase your changes on the latest origin/master. I'd completely missed the deprecation of the macos-11 runner that many of the tests were relying on :/ Sorry for the inconvenience.

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.

2 participants