问题
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