[CMake] CMake Cross Compiling for arm-linux

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 13 20:11:50 EDT 2008


On Friday 14 March 2008, John Xu wrote:
> Of course. Here is the toolchain file content:
>
> # This one is important
> SET(CMAKE_SYSTEM_NAME Linux)
>
> # This one not so much
> SET(CMAKE_SYSTEM_VERSION 2.5)
>
> # Specify the cross compiler
> SET(CMAKE_FORCE_C_COMPILER /cross/arm-linux/bin/arm-linux-gcc GNU)
> SET(CMAKE_FORCE_CXX_COMPILER /cross/arm-linux/bin/arm-linux-g++ GNU)
>

This one is wrong:
> # Where is the target environment
> SET(CMAKE_FIND_ROOT_PATH / )

Where are the libraries and headers for the cross compiler installed ? You 
have to put that bse directory here. Otherwise it will try to link the stuff 
against your native libs, which won't work.

> Here is the command line content:

Don't set the CC and CXX environment variables, this is already specified in 
the toolchain file.

> CC=arm-linux-gcc CXX=arm-linux-g++ cmake -Wno-dev -DCMAKE_TOOLCHAIN_FILE=
> Toolchain-arm-linux.cmake -DCMAKE_INSTALL_PREFIX=$PREFIX/$LIBSUFFIX
> /my/source/directory

Bye
Alex


More information about the CMake mailing list