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 autodetect CMAKE_SYSTEM_VERSION to convert to Darwin version #16335

Merged
merged 8 commits into from
May 30, 2024

Conversation

juansblanco
Copy link
Contributor

@juansblanco juansblanco commented May 24, 2024

Changelog: Fix: Change autodetect of CMAKE_SYSTEM_VERSION to use the Darwin version.
Docs: conan-io/docs#3755

CMAKE_SYSTEM_NAME and CMAKE_SYSTEM_VERSION are required to be set when cross-compiling.
https://cmake.org/cmake/help/latest/variable/CMAKE_SYSTEM_VERSION.html
We recommend that users set them in the toolchain or through confs, but if they are not set we autodetect them based on the profile settings.
In the case of macOS systems, the CMAKE_SYSTEM_VERSION variable was set to the macOS version, but it needs to be the Darwin version. We need to set the Darwin version for each Apple system: https://en.wikipedia.org/wiki/Darwin_(operating_system)#Darwin_20_onwards

This PR fixes it by converting the macOS versions to Darwin versions when the user doesn't set the variable.
Other option could be to stop autodetecting this variables and force users to set it themselves.

CMake states that the CMAKE_SYSTEM_VERSION is not usually set for Darwin systems and is not particularly meaningful, and users should be careful when making use of it in their projects.
It has almost no utility on the CMake side for Darwin systems
https://github.com/Kitware/CMake/blob/f0074159d75601145b6ab0a98d636ec4c17a4370/Modules/Platform/Darwin.cmake#L18

Closes: #16282

@juansblanco juansblanco added this to the 2.4.0 milestone May 24, 2024
@juansblanco juansblanco requested a review from jcar87 May 24, 2024 12:40
@czoido czoido assigned memsharded and unassigned czoido and memsharded May 29, 2024
Copy link
Contributor

@jcar87 jcar87 left a comment

Choose a reason for hiding this comment

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

LGTM!

@memsharded memsharded merged commit c9e1494 into conan-io:develop2 May 30, 2024
2 checks passed
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.

CMAKE_SYSTEM_VERSION is not correctly set when autodetected
4 participants