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

Bjørn Forsman bjorn.forsman at gmail.com
Mon Jan 10 11:43:57 EST 2011


Hi,

On 10 January 2011 17:00, Emmanuel Blot <eblot.ml at gmail.com> wrote:
> Hello,
>
> Using the ADD_LIBRARY command for a static library (.a), how to tell
> CMake to use the ranlib tool for the target, not the default one for
> the host?
>
> I'm getting the following warning message:
>
> cd watchdog && /usr/local/Cellar/cmake/2.8.3/bin/cmake -E
> cmake_link_script CMakeFiles/nd_watchdog.dir/link.txt --verbose=1
> /usr/bin/ar cr libnd_watchdog.a  CMakeFiles/nd_watchdog.dir/src/nd_watchdog.c.o
> /usr/bin/ranlib libnd_watchdog.a
> /usr/bin/ranlib: warning for library: libnd_watchdog.a the table of
> contents is empty (no object file members in the library define global
> symbols)
>
> I'd like to use our dedicated arm-eabi-ranlib tool instead.

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?

Have you read http://cmake.org/Wiki/CMake_Cross_Compiling ?

Best regards,
Bjørn Forsman


More information about the CMake mailing list