[CMake] Cross-compiling a static library (CMake 2.8.3)

Bjørn Forsman bjorn.forsman at gmail.com
Mon Jan 10 12:59:50 EST 2011


Hi,

(CCing the list.)

2011/1/10 Emmanuel Blot <eblot.ml at gmail.com>:
>> When I cross compile I do "set(CMAKE_C_COMPILER arm-linux-gcc)"
>> in a toolchain file and CMake automatically finds ranlib (and other
>> toolchain utilities) using the prefix from the C compiler. How do you
>> setup CMake for cross-compilation?
>
> INCLUDE (CMakeForceCompiler)
> CMAKE_FORCE_C_COMPILER (arm-eabi-gcc-4.5.2 GNU 4)

I haven't used that one before. The docs say it should be used
when CMake is not able to detect the compiler ID. Is that the case here?
Have you tried "set(CMAKE_C_COMPILER arm-linux-gcc)"?

> Maybe the version number is the source of the trouble ?

The docs say that the signature is
CMAKE_FORCE_C_COMPILER(<compiler> <compiler-id>)
so maybe something bad happens when you give it that extra
argument "4"? Try without "4"?

Best regards,
Bjørn Forsman

>> Have you read http://cmake.org/Wiki/CMake_Cross_Compiling ?
> Not for a while, however I've been using CMake for cross compiling
> since early releases (2.5.x), so maybe the syntax changed a bit since.


More information about the CMake mailing list