views:

3174

answers:

3

I was using classic Unix Makefile generator until I found a webpage explaining CMake could produce a nice xcode project file using "cmake -G Xcode" so I ran that command in my source directory and I get a nice xcode project. This is great but I'm facing some drawback and was wondering if there are solutions to these :

  • now I can't build out of tree using unix makefiles (I use to run cmake ../myproj in a build dir and then make command) this doesn't work anymore (I suppose temp files in the project dir are responsible)

  • some of my headers are generated by cmake (myproj.h.in became myproj.h and is include in some tests for example) but I can't find those files in the xcode project I get.

Thanks in advance for any good advice on how I can combine xcode project and unix makefile to be able to use both.

+1  A: 

You can build an Xcode project from a standard unix/linux project which includes a Makefile or a ./configure by creating a custom target that will invoque adequate commands.

You can find details on this, and more, in this article from Apple: Building an Open Source Universal Binary

mouviciel
this is not what I want since I would like to have the benefit of the CMake Xcode generator to have a proper Xcode project.
claferri
+4  A: 

I found the answer by myself (I mean asking the good person) :

Use 2 separate build directories for each type of build files. This will ensure each build directory has the correct build files and generated files for its use.

In the add_executable() command, in addition to the source files also include the headers and generated headers for those to show up in Xcode.

claferri
A: 

I dont quite follow the procedure mentioned above , if you have figured out could you please give a more detailed explanation . thanks

IamRndm