Can I create an iOS unit test target for XCode (OC

2019-05-12 20:43发布

I currently use CMake to create my iOS xcode project, for both my static libs and application target. Now would like to create the unit test target from CMake as well, but haven't found any resources on whether CMake supports this or how to create the octest target.

Can I create this from CMake? If so, could you explain how?

1条回答
Summer. ? 凉城
2楼-- · 2019-05-12 21:17

No, CMake doesn't support unit tests on iOS. Also you can not run separate executables on iOS.

One of the solutions could be compiling your unit tests into a static library instead of executable and then link them to your XCTests or OCTests. You can do some magic with linker by creating alias for the main function and hiding all the other symbols.

All the test properties you would have to implement yourself.

查看更多
登录 后发表回答