简体   繁体   中英

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

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM