warning: overriding '-mmacosx-version-min=10.14' option

Jacob Carlborg doob at me.com
Wed Jan 15 19:55:48 UTC 2020


On 2020-01-12 13:02, kinke wrote:

> Without specifying a C cross-compiler directly, either via setting the 
> CC env variable or by using a CMake toolchain file, CMake will probe and 
> configure the compiler for the host.

Aha, I see. So I've been lucky so far that is has worked. Probably 
because the Posix layer on macOS and iOS is basically the same.

Originally I did what Xcode is doing. It invokes the same compiler 
regardless the target platform. I just specifies different target 
triples with the `-target` flag and different SDKs with the `-isysroot` 
flag. As far as I know there's never been a compiler that targets a 
specific platform by Apple. They have always used flags like above 
mentioned.

> There are probably guides for how to set up CMake cross-compilation from 
> macOS to iOS. There might even be some builtin CMake support in the 
> meantime: https://gitlab.kitware.com/cmake/cmake/issues/17870

Yeah, I found some documentation now [1], seems to be officially 
supported. Seems to work like this:

* CMAKE_SYSTEM_NAME - Specifies the target platform. Will detect the 
correct SDK. This adds the `-isysroot` flag.

* CMAKE_OSX_ARCHITECTURES - Specifies the target architecture. This will 
add the `-arch` flag.

* CMAKE_OSX_DEPLOYMENT_TARGET - Specifies the minimal deployment target. 
This will (for iOS) add the `-miphoneos-version-min` flag.

The flags `-arch arm64 -miphoneos-version-min=12.0` will give the same 
binary as `-target arm64-apple-ios12.0`.

Although, I still need to specify 
`--cFlags='-target;arm64-apple-ios12.0'` otherwise the assembly files 
(threadasm.S and eh_asm.S) are compiled for macOS x86-64 instead of iOS 
ARM64. Not sure if that's a bug in CMake or in the LDC configuration.

> The spaces here should be replaced by semicolons.

Ok, I see.

[1] 
https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html#cross-compiling-for-ios-tvos-or-watchos

-- 
/Jacob Carlborg


More information about the digitalmars-d-ldc mailing list