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

Pierre Habouzit madcoder at debian.org
Sat May 26 17:16:28 EDT 2007


On Sat, May 26, 2007 at 02:41:37PM +0100, Trevor Kellaway wrote:
> Hi,
> 
> Does anyone know how to add an explicit reference to a pre-existing
> object file (no related source file) to the link?
> 
> I've tried:
> 
> 	ADD_EXECUTABLE(myapp mysrc1.c mysrc2. myexisiting.o)
> 
> If I perform the above CMake complains it doesn't know how to build
> myexisiting.o.
> 
> FYI, my myexisiting.o is an embedded compiler's startup code that is
> delivered as a pre-built object.

  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.

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


-- 
·O·  Pierre Habouzit
··O                                                madcoder at debian.org
OOO                                                http://www.madism.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://public.kitware.com/pipermail/cmake/attachments/20070526/07697d2b/attachment.pgp


More information about the CMake mailing list