I'm trying to run CMake on a C++ project for iOS. We're setting the following values:
export CC="$(xcrun --sdk iphoneos --find clang) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch arm64 -fPIC -miphoneos-version-min=9.0 -lresolv -D DEBUG_IOS -fembed-bitcode"
export CXX="$(xcrun --sdk iphoneos --find clang++) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch arm64 -fPIC -miphoneos-version-min=9.0 -lresolv -D DEBUG_IOS -Werror=vla -fembed-bitcode"
export LD="$(xcrun --sdk iphoneos --find ld) -isysroot $(xcrun --sdk iphoneos --show-sdk-path) -arch arm64 -all_load"
However, when we run CMake, it fails with the following:
Building C object CMakeFiles/cmTC_59164.dir/testCCompiler.c.o
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS13.0.sdk -arch arm64 -fPIC -miphoneos-version-min=9.0 -lresolv -D DEBUG_IOS -fembed-bitcode -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -mmacosx-version-min=10.14 -o CMakeFiles/cmTC_59164.dir/testCCompiler.c.o -c /Users/asdf/code/trl-tunnel/libbuilder/ios/librltun/build/CMakeFiles/CMakeTmp/testCCompiler.c
clang: warning: -lresolv: 'linker' input unused [-Wunused-command-line-argument]
clang: error: invalid argument '-mmacosx-version-min=10.14' not allowed with '-miphoneos-version-min=9.0'
gmake[1]: *** [CMakeFiles/cmTC_59164.dir/build.make:66: CMakeFiles/cmTC_59164.dir/testCCompiler.c.o] Error 1
gmake[1]: Leaving directory '/Users/asdf/code/trl-tunnel/libbuilder/ios/librltun/build/CMakeFiles/CMakeTmp'
gmake: *** [Makefile:121: cmTC_59164/fast] Error 2
macosx-version-min is being added automatically and conflicts with our supplied argument of iphoneos-version-min.
Any idea why the MacOS target would be added? or how I can get rid of it?