swiftxcodemacosipadosldflags

Dynamic OTHER_LDFLAGS in Xcode that are different between Mac (iPadOS designed app) and iOS app


I want to define different OTHER_LDFLAGS for the MacOS app and iOS app. We have one project that builds from iOS to iPhone / iPad / MacOS (iPad-designed iOS) apps. For iPhone and iPad I require to use one bunch of flags but for MacOS different.

Unfortunately, Xcode provides a MacOS selection condition that works only for Catalyst but does not work for MacOS (iPad-designed iOS) app. >>

OTHER_LDFLAGS[sdk=macosx*]

-> is not supporting iPad designed MacOS app.

Does anybody know what trick I can apply to differentiate them and pass a specific parameters for each platform?

I would like to have different flags per each platform iOS and Mac (iPad Designed iOS)

Thank you


Solution

  • Finally, I came to the place which is running in runtime check. Taking into consideration that I have a handler from the library the action was possible to be taken there as there is no way to understand the platform in the configuration layer as the build will be commonly the same as the platform is iOS. The worst thing was I need to work with C++ which should be this handler and bridge native iOS in C++ to retrieve the flag isIOSOnMac.

    That was a workable solution for my case