![]() The default is $(NATIVE_ARCH_ACTUAL) so as to preserve backward compatible behavior where the build defaulted to a single architecture. This is the cause of why you see that (harmless) warning in recent Xcode versions. I think there’s room for improvement in the way CMake handles the SDK setting, it should probably put macosx (or whatever the relevant value is) instead of the full path to the SDK in the relevant field of the Xcode project file, but I think that might require non-trivial changes to CMake due to the baked-in assumption about CMAKE_OSX_SYSROOT holding the full path to the SDK in some places. The SDK is controlled by CMAKE_OSX_SYSROOT and should be left empty for macOS builds. Your code sample sets it as an ordinary variable, so it will be discarded and replaced by the default (this may well be the source of your problems). The deployment version is specified separately by the CMAKE_OSX_DEPLOYMENT_TARGET, which must be set before the first call to project() and it must be a cache variable. Way back in the past, people sometimes liked to copy forward an SDK from an older Xcode to a newer Xcode, but that has never been technically supported and is something that shouldn’t be done these days (there’s never been any guarantee that this would work and things could silently go wrong). If your project requires some minimum SDK version to build, it would be better to advertise that as some minimum Xcode version (my personal view). You get one SDK with an Xcode installation and you shouldn’t really ever have to specify the SDK version. They are two distinct things and should not be specified via a single variable.Ī minimum SDK version basically corresponds to a minimum Xcode version. You seem to be confusing the SDK version with the deployment version, at least partially. ![]() My project only says this, and then again I have to manually set the value in Xcode. I also don’t understand why ARCHS is never set to $(ARCHS_STANDARD), despite the set call. This should likely be the default that says “use the latest sdk”. I can only set macosx11.0 so that CMake I guess can look it up. When I set the project “Base SDK” to macOS, then the project reflects this, but I’m unable to set SYSROOT to that. Applications/Xcode.app/Contents/Developer/Platforms/atform/Developer/SDKs/MacOSX11.0.sdk This is the symlink path on my machine to MacOSX.sdk, but I think Xcode just wants macosx11.0 for that field, not a full path as specified by CMake when SYSROOT isn’t specified. For CMake newbies, this doesn’t leave them with much to work with since they have to then understand CMake internals and debugging from the command line. That’s way safer than what happens when SYSROOT is set, the sdk not found, and CMake fails to even gen a project. Have a setting like SDK_TARGET=11.0 that says that I need 11.0 SDK or higher, fail if it’s not set. I guess a request is something like DEPLOYMENT_TARGET. ![]() Set(CMAKE_OSX_ARCHITECTURES "$(ARCHS_STANDARD)") <- this doesn't work either Set(CMAKE_OSX_DEPLOYMENT_TARGET 10.14) # this works, great! # set(CMAKE_OSX_SYSROOT macos) # this doesn't work, despite there being a macos.sdk Set(CMAKE_OSX_SYSROOT macosx11.0) # this only works, finds macosx11.0.sdk in Xcode 12.2 # Xcode 12.3 completely breaks when this is set and can't find c compilers. Snippet from CMakeLists.txt # Xcode 12.2 ships with macosx11.0, but 12.3 ships with macosx11.1 I’m on CMake 3.19.1 on macOS Intel and ARM. What is the cmake specification for use whatever is the available SDK in Xcode? Also setting ARCHS_STANDARD doesnt work. I don’t want devs to have to chase changing this, and CMake really really breaks when it can’t find the SDK and declares invalid C and CXX and OBJ_CXX compilers instead of just stating that it couldn’t find the SDK. One another machine, the newer Xcode breaks. So then I specify the build number (see below), and that works on my machine. ![]() SYSROOT is effectively, the maximum build of macOS that the app supports. ![]() If you don’t specify CMAKE_OSX_SYSROOT, then CMake seems to default to some invalid SDK, or uses the DEPLOYMENT_TARGET which is far too low for the SDK. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |