How to build library for iOS in command line

Hello,

I try to build c++ library and swift library, based on c++ library and then include it in iOS application. But I can't find a way to build it from command line. SPM always target MacOSX. I try to use full path to sdk:

swift build --target cxxLibn --sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.5.sdk

But just get warning:

clang: warning: using sysroot for 'iPhoneOS' but targeting 'MacOSX' [-Wincompatible-sysroot]

It would be good to have options to build at least static libraries from command line.

1 Like