Skip to content

Xcode: Allow empty source file list for iOS Sticker packs

Andrew Shaitorov requested to merge andrew.shaitorov/cmake:master into master

Hi!

We have a issue compiling iOS stickers app extension.

Here is a small project to reproduce the issue:

https://gitlab.kitware.com/andrew.shaitorov/cmakeiosstickersbug

mkdir Output
cd Output
cmake -DCMAKE_TOOLCHAIN_FILE=../iOS.cmake -G Xcode ..
xcodebuild PRODUCT_BUNDLE_IDENTIFIER="com.somecompany.stickers" CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY=\"\" CODE_SIGNING_REQUIRED=NO

Will produce on Xcode new build system using CMake 3.19.1:

error: Multiple commands produce '/Users/test/_stickers/Output/Debug-iphoneos/stickers.appex/stickers':
1) Target 'stickers' (project 'Stickers'): Ditto /Users/test/_stickers/Output/Debug-iphoneos/stickers.appex/stickers /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Application Support/MessagesApplicationExtensionStub/MessagesApplicationExtensionStub
2) Target 'stickers' (project 'Stickers') has link command with output '/Users/test/_stickers/Output/Debug-iphoneos/stickers.appex/stickers'

As we understand Xcode uses some precompiled binary from iOS SDK, that's why source list must be empty to disable linker, which will overwrite the precompiled binary.

Currently CMake adds an empty source file when source list is empty and this merge request will disable this behavior for XCODE_PRODUCT_TYPE = 'com.apple.product-type.app-extension.messages-sticker-pack'.

Topic-rename: xcode-ios-empty-sticker-pack

Edited by Brad King

Merge request reports