ios-cmake icon indicating copy to clipboard operation
ios-cmake copied to clipboard

Fix setting of CMAKE_SYSTEM_NAME

Open EduMenges opened this issue 1 year ago • 2 comments

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 avatar Jun 20 '24 18:06 EduMenges

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.

EduMenges avatar Jun 28 '24 19:06 EduMenges

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.

leetal avatar Jul 18 '24 09:07 leetal