[CMake] CMake generators (Xcode and Unix Makefile)

Michael Jackson mike.jackson at bluequartz.net
Wed Apr 15 10:55:28 EDT 2009



On Apr 15, 2009, at 9:57 AM, christophe laferriere wrote:

> Hi all,
>
> 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.

Use 2 separate build directories for each type of build files, ie, use  
Build-make for makefiles and Build-xcode for Xcode project builds.  
This will ensure each build directory has the correct build files and  
generated files for its use.

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

Lastly, in the Xcode preferences, under the "Debugging" topic you may  
want to turn OFF the "Load Symbols Lazily" so debugging actually works.

<opinion>If Xcode is too much of a pain and you are NOT building 64  
bit binaries then you can try Eclipse CDT instead. It will work with  
your makefiles OR you can use the Eclipse CDT generator to generate an  
actual Eclipse CDT project. I personally use Eclipse CDT with plain  
makefiles and am very happy with it. There seems to be an issue with  
Eclipse being able to recognize a 64 bit binary. You can still build  
them but the Eclipse CDT debugger does not recognize them to actually  
debug them. bummer.</opinion>

<Even more lastly>Qt has "QtCreator" which is starting to get support  
for Makefiles. In early versions it looked very promising and was  
faster to edit files than either Eclipse or Xcode. Just something to  
keep on eye on.</Even more lastly>

_________________________________________________________
Mike Jackson                  mike.jackson at bluequartz.net
BlueQuartz Software                    www.bluequartz.net
Principal Software Engineer                  Dayton, Ohio


More information about the CMake mailing list