Skip to content

Build Project IOS #1372

Closed Answered by rh101
NgVThangBz asked this question in Q&A
Discussion options

You must be logged in to vote

but it seems that Cmake cannot add .swift files, so how can I save the settings of the IOS project?

What makes you think that?

A quick online search for "cmake swift example", and you would see a few hundred thousand results showing you how this is done.

The simplest way is to change the project at the top of your root CMakeLists.txt to this:

if(APPLE)
    project(${APP_NAME} LANGUAGES C CXX OBJC OBJCXX Swift)
else()
    project(${APP_NAME} LANGUAGES C CXX)
endif()

Then you need to set several properties:

set_target_properties(${YourTarget} PROPERTIES
XCODE_ATTRIBUTE_SWIFT_VERSION "4.0"
XCODE_ATTRIBUTE_SWIFT_OBJC_INTERFACE_HEADER_NAME "somefilename-Swift.h"
XCODE_ATTRIBUTE_SWIFT_OBJC_B…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NgVThangBz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants