[CMake] xcode project and static library dependencies

Nick Kledzik kledzik at apple.com
Thu Jan 13 15:16:37 EST 2011


I'm a long time Xcode user and recently used cmake to create an Xcode project for LLVM.  I really like the idea the CMake can produce native projects for different platforms, but in my case, the resulting xcode project was very slow to use.  

To investigate, I created a small cmake example project with a static library and a main executable that uses the library.   The generated Xcode project does not encode the static library as a link library of the main executable.  Instead the static library is slipped in via OTHER_LDFLAGS.  Thus, Xcode does not know that if a source file of the static library is changed, that the main executable needs to be relinked.  

The generated Xcode project also has extra shell script phases (CMake ReRun, and CMAKE PostBuild Rules).  I'm not sure why they are there, but they slow down large builds (like llvm).  But they do have the side effect of causing Xcode to re-evaluate the mod times of files, which in a way, compensates for missing static library dependency.

I'd like to contribute to making the xcode project generator better, but would like to understand why the current implementation works as it does.  

-Nick



More information about the CMake mailing list