[CMake] Link order of object files

Alexander Neundorf a.neundorf-work at gmx.net
Mon Jun 21 15:17:31 EDT 2010


On Monday 21 June 2010, Mathias Lafeldt wrote:
> Hi,
>
> is there a way to tell CMake in which order to link in object files?
>
> For example, I got the following executable:
>
> 	ADD_EXECUTABLE(hello crt0.o hello.c)
>
> Using a disassembler, I can see that hello.c is compiled in before
> crt0.o, but I want crt0.o to always be the first.
>
> Also, this gives me the same result:
>
> 	ADD_EXECUTABLE(hello hello.c crt0.o)

Is this for some embedded system ?
You may consider putting crt0.o in the CMAKE_C_LINK_EXECUTABLE variable for 
your target.

Alex


More information about the CMake mailing list