[CMake] Linker Flags

Reinhard Thies Reinhard.Thies at web.de
Wed Nov 24 08:26:05 EST 2010


On Wednesday 24 November 2010 12:05:49 Reinhard Thies wrote:
> Hi all,
> 
> i am trying to crosscompile one of my projects. Iam using some linker flags
> for that:
> 
> SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m5307 -Wl,-elf2flt
> -Os -lc")
> 
> The following link command will be generated, but I need the -lc option at
> the end of the line.
> 
> /usr/bin/cmake -E cmake_link_script CMakeFiles/ethgate.dir/link.txt --
> verbose=1
> /usr/local/bin/m68k-elf-gcc     -m5307 -Wl,-elf2flt -Os -lc
> CMakeFiles/ethgate.dir/src/ethgate.c.o
> CMakeFiles/ethgate.dir/src/serveritf.c.o
> CMakeFiles/ethgate.dir/src/ident_service.c.o
> CMakeFiles/ethgate.dir/src/dbgitf.c.o CMakeFiles/ethgate.dir/src/debug.c.o 
> -o ethgate -rdynamic
> 
> This command works but the above one doesn't.
> 
> /usr/local/bin/m68k-elf-gcc     -m5307 -Wl,-elf2flt -Os
> CMakeFiles/ethgate.dir/src/ethgate.c.o
> CMakeFiles/ethgate.dir/src/serveritf.c.o
> CMakeFiles/ethgate.dir/src/ident_service.c.o
> CMakeFiles/ethgate.dir/src/dbgitf.c.o CMakeFiles/ethgate.dir/src/debug.c.o 
> -o ethgate -lc
> 
> So what do I have to change to get that command. And how can I remove -
> rdynamic ?
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS) removes -rdynamic

and thr -lc question was a bit stupid 
TARGET_LINK_LIBRARIES solved it ;-)

thx, for not telling me that I was sleering well this morning ;-)

-- 
Danke & Gruss
Reinhard Thies


More information about the CMake mailing list