[CMake] xcode project and static library dependencies

Bill Hoffman bill.hoffman at kitware.com
Thu Jan 13 15:41:06 EST 2011


On 1/13/2011 3:16 PM, Nick Kledzik wrote:
> 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.
>

This is because Xcode provides no way to order static libraries as far 
as I can tell, or to repeat them.   Also, no way to depend on a static 
library or a file directly, forcing the makefile usage.  This may have 
changed, so, if you can so native Xcode projects that can do the 
following we can change cmake:

- have a static library show up more than once on a link line
- be able to specify the order of static libraries on the link line
- be able to relink and executable when a static library that it depends 
on is rebuilt.

-Bill


More information about the CMake mailing list