[CMake] Add pre-existing object file to linker line?

Trevor Kellaway tkellaway at asl-electronics.co.uk
Sat May 26 18:45:45 EDT 2007


Pierre,

Thanks for you suggestions.
 
> > Does anyone know how to add an explicit reference to a pre-existing 
> > object file (no related source file) to the link?
>
>   Why don't you add it in the LINK_FLAGS or whatever the name 
> is ? If this .o is floating in the ether, you don't really 
> need to list it as a dependency right ? You just need to have 
> it linked.

Unfortunately it can't be specified in the LINK_FLAGS as it is position
sensitive and needs to be with the other objects as there are keywords
between the flags and the objects in the link command line.


>   And if you stil need the dependency, I guess an 
> ADD_DEPENDENCY(myapp myexisting.o) could do it.

I tried this (actually "ADD_DEPENDENCIES"), and it was silently ignored.

I've worked around the problem by introducing additional platform
support for my startup code and RTL for the embedded compiler.

 - TrevK


More information about the CMake mailing list