[CMake] Crosscompiling for arm linux on cmake 2.8.0

Alexander Neundorf a.neundorf-work at gmx.net
Thu Apr 8 16:28:56 EDT 2010


On Wednesday 07 April 2010, Luigi Grilli wrote:
> I'm trying to cross compile for ARM with this command:

Not sure, but I would put all the -Dsomething=foo _before_ the path to the 
source directory:

> cmake . -DCMAKE_BUILD_TYPE=DEBUG
> -DCMAKE_TOOLCHAIN_FILE=arm-gcc3.4.5.cmake
>
>
>
> Here is my toolchain file:


This line really should not be necessary:
> INCLUDE(CMakeForceCompiler)
>
>
>
> # this one is important
>
> SET(CMAKE_SYSTEM_NAME Linux)
>
> set(CMAKE_SYSTEM_PROCESSOR arm)
>
>
>
> #this one not so much
>
> SET(CMAKE_SYSTEM_VERSION 1)
>
>
>
> # specify the cross compiler
>
> SET(CMAKE_C_COMPILER   arm-linux-gcc)
>
> SET(CMAKE_CXX_COMPILER arm-linux-g++)
>
>
>
> # where is the target environment
>
> SET(CMAKE_FIND_ROOT_PATH  /my-path-to-toolchain/arm-unknown-linux-gnu)
>
>
>
> # search for programs in the build host directories
>
> SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
>
> # for libraries and headers in the target directories
>
> SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
>
> SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
>
>
>
>
>
> My cmake version is 2.8.0
>
>
>
> Anyway the "-DCMAKE_TOOLCHAIN_FILE" option seems to be completely
> ignored (for example if I try to set a file that doesn't exists cmake
> doesn't complain with that). In fact it always does the makefile for the
> host system and not the target.
>
>
>
> Is the toolchain manament different from cmake 2.6? I read the
> documentation twice and they say to do exactly this way.
>
> Any help will be appreciated.
>
> Thanks


More information about the CMake mailing list