[CMake] Problem with cygwin and CodeSourcery's ARM Toolchain

Thomas Kindler mail+cmake at t-kindler.de
Thu May 7 12:15:40 EDT 2009


Hendrik Sattler wrote:
> Zitat von Thomas Kindler <mail+cmake at t-kindler.de>:
>> cmake tries to use cygwin-style absolute "/home/tkindler.." paths,
>> which arm-none-eabi-gcc doesn't seem to like (being a native win32
>> program).
>>
>> My old makefile used relative paths to invoke the compiler. How can I
>> do this in cmake generated makefiles?!
>>
>> Prepending "c:/cygwin/" to all paths should also solve the problem.
> 
> If you have a native compiler, use the native compiled cmake. If you 
> have a compiler/tool that depends on cygwin, use the cygwin-compiled cmake.
> Living in both worlds (native vs. cygwin) is a major pain. Just don't.

Ok.. that part seems to work after installing the native windows cmake.

The resulting binary is still not usable -- cmake inserts an "-fPIC" 
linker flag.

   arm-none-eabi-gcc.exe  -fPIC $(stm32test_OBJECTS)  [..]

How can I switch that off?

I also need to specify a special linker script for my target. In my 
plain old makefile I just added -Tstm32f10x.ld to my linker command line.

What's the official cmake way to add custom linker flags?!

Adding it to target_link_libraries( .. )  seems to work, but feels wrong.

Also: Right now, I have to invoke cmake by this lengthy command:

   cmake -DCMAKE_TOOLCHAIN_FILE=CodeSourcery.cmake -G"Unix Makefiles" .

when compiling the project for the first time.  How can I specify a 
default toolchain and generator in the CMakeLists.txt itself?

-- 
Dipl.-Inform. Thomas Kindler <mail+cmake at t-kindler.de>
"Zuse, Zuse" sprach die Tante, als das Rechenzimmer brannte


More information about the CMake mailing list