I am trying to build a framework with a combination of swift and C files and using cmake to generate the XCode Project:
After generating the project using this command:
add_library(MyLibrary STATIC ${FLAT_LIBRARY_FILES})
set_target_properties(MyLibrary PROPERTIES
FRAMEWORK TRUE
MACOSX_FRAMEWORK_IDENTIFIER com.MyLibrary.MyLibrary
# "current version" in semantic format in Mach-O binary file
VERSION 16.4.0
# "compatibility version" in semantic format in Mach-O binary file
SOVERSION 1.0.0
PUBLIC_HEADER MyLibrary.h
DEFINES_MODULE YES
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer")
with command:
cmake -G Xcode -B ./build/sdk/ios ./sdk/ios
but after this project is generated, I still have to do the following to be able to build the library for iOS:
- Add iOS as platform
- Add swift files to target (C files are added to the target correctly)
- Set
defines_moduleto true - Set
swift_version - Uncheck test file from target
- Make headers public
There have been scant documentation about dealing with this scenario and I have tried various set() commands that I was able to find, to no success. How can I handle this?