[CMake] Link order of object files

Eric Noulard eric.noulard at gmail.com
Tue Jun 22 10:51:54 EDT 2010


2010/6/22 Mathias Lafeldt <misfire at debugon.org>:
> Alexander Neundorf wrote:
>> 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 ?
>
> It's for the MIPS R5900 processor aka Emotion Engine.
>
>> You may consider putting crt0.o in the CMAKE_C_LINK_EXECUTABLE variable for
>> your target.
>
> Thank you. I didn't know about CMAKE_C_LINK_EXECUTABLE, but it seems to
> be suitable.

You may have a list of usable variables using command line:
cmake --help-variable-list

Normally you could have detail about one particular variable with:

cmake --help-variable THE_VAR

but

cmake --help-variable CMAKE_C_LINK_EXECUTABLE says:
Argument "CMAKE_C_LINK_EXECUTABLE" to --help-variable is not a defined variable.

cmake --help-variable CMAKE_\<LANG\>_LINK_EXECUTABLE
Argument "CMAKE_C_LINK_EXECUTABLE" to --help-variable is not a defined variable.



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list