Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preserving Header Directory Structure in Xcode for Static Library

I'm developing a static library in C++ using Xcode. I have an Installation Directory set where it copies all of my public header files, but when I compile it just copies all the headers into one directory. Is there a way to tell Xcode to preserve the directory structure of my header files? Thanks in advance!

like image 838
dkaranovich Avatar asked Jan 06 '12 03:01

dkaranovich


People also ask

Does static library need header files?

You can have the libraries installed without the headers. You can't then compile code that uses the header, but you can run code that uses the shared library.

How do I open a header file in Xcode?

Holding the Command key, click the import/include statement to view the header. Also, you can Command-click on a symbol to jump to the header file that defines it. Alternatively, you can select the pull down menu at the far left of the jump bar, and go down to the "includes" submenu and select the header file to view.


1 Answers

I also needed to preserve the header file directory structure for a C++ library project and I finally managed to do it. It is ridiculously complicated with XCode, compared to the simple nature of the task. The key is to create "folder references" at first, then to copy the header folders in an extra build phase and afterwards to delete .c/.cpp-files from these exported header folders with a script, because XCode will not only copy the .h-files.

I've written a blog post here on how to all achieve that, because it's more tricky in detail. You might also want to check out an example XCode project that I've pot on github.

like image 199
IsaacKleiner Avatar answered Oct 26 '22 22:10

IsaacKleiner