-
Notifications
You must be signed in to change notification settings - Fork 946
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
[question] settings.os.version vs CMAKE_SYSTEM_VERSION for macOS #16270
Comments
Hi @solarispika Thanks for your question
Maybe I would challenge the approach in the first place? What is the feature that is being disabled? Isn't it better to have it defined explicitly (in an imperative way)? In general being explicit about what features of a library to enable/disable is better than letting the build systems to guess or autodetect things. It is possible for a recipe to just patch the build system script to do exactly what you want when you want. |
Hi @memsharded The library is not owned by us, and it is FSEvents of macOS that is disabled when Darwin version is not greater than 9, maybe due to it's only available for newer versions of Darwin. Since the libray is not listed in conan index, so we provided a simple recipe for it ourself. We can patch CMakeLists.txt of the library, and it looks more reasonable. BTW, I still would like to know how those version settings work together, can you help me on it? |
That wouldn't be a blocker. Tons of ConanCenter recipes do patches to the libraries that they don't own, to be able to correctly package them. If that helps you, it is ok to patch the CMakeLists.txt (or other build scripts) of the library, it is not uncommon that build scripts are not perfect for all scenarios, specially for cross-compiling or other advanced scenarios, that maybe the original authors didn't take into account.
Good, yes, I think it can make sense for this case.
I think it goes like this:
|
What values am I supposed to give? Those values defined in default settings are macos versions, but I thought it should be Darwin version per CMake's documentation on
|
Hi @solarispika, Thanks a lot for reporting. I have just opened an issue as I think that we are not setting the correct value for |
What is your question?
I have encountered an issue with a library that uses
CMAKE_SYSTEM_VERSION
to disable a feature. When cross-compiling it on macOS Apple Silicon for macOS Intel,CMAKE_SYSTEM_VERSION
is not set, leading to inconsistent behavior between native and cross-compilation builds. Although the cross-compiled version does not function correctly, this is a separate issue.I want to resolve this by correctly specifying
CMAKE_SYSTEM_VERSION
. According to Conan's documentation:This raises confusion about which version to use.
CMake's
CMAKE_SYSTEM_VERSION
refers to the OS version, which for macOS is the Darwin version. This is supported byCMAKE_SYSTEM_NAME
beingDarwin
for macOS. Conversely, Conan'ssettings.os
and its version refer to macOS versions.Additionally, Conan may set
CMAKE_SYSTEM_VERSION
toos.version
oros.sdk_version
(which aligns with macOS versions) when cross-building:When I set
os.sdk_version=11.0
, the library failed to configure because the-isysroot
was set tomacosx11.0
, and the compiler couldn't find such a sysroot:It only worked when setting the version through
tools.cmake.cmaketoolchain:system_version
.Could you please advise on the correct way to set these versions?
Thanks.
Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: