Can I create an iOS unit test target for XCode (OCUnit) with CMake?

a 夏天 提交于 2020-01-02 08:53:13

问题


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:


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.



来源:https://stackoverflow.com/questions/13829642/can-i-create-an-ios-unit-test-target-for-xcode-ocunit-with-cmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!