How do I compile a library in Xcode using a makefi

2019-09-17 20:07发布

问题:

I need to compile a library written in C in Xcode. For this I need to use a make file. How can I include a make file in my project?

Any link for writing a make file or sample of a make file for running on the iOS simulator would be helpful.

Also if I use cmake, then what commands do I use in the terminal to create a static Library for iOS simulator?

Thanks

回答1:

First, your project generator is either Xcode or Make. You can't have a makefile in Xcode.

If you want to generate an iOS library from C/C++ sources, take a look at this google project. The project wiki explains how to use the iOS CMake toolchain. This will give you a .xcodeproj file. You can build and then link to that library from other iOS projects. Also there's this fork available on Github which you could take a look at.

If the target system is exclusively iOS, you could alternatively create a new iOS library project from scratch (no CMake) and throw in your sources manually.



标签: ios xcode cmake