[CMake] Crosscompiling for arm linux on cmake 2.8.0

Yegor Yefremov yegor_sub1 at visionsystems.de
Wed Apr 7 10:59:39 EDT 2010


> I’m trying to cross compile for ARM with this command:
> 
>  
> 
> cmake . -DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_TOOLCHAIN_FILE=arm-gcc3.4.5.cmake
> 
>  
> 
> Here is my toolchain file:
> 
>  
> 
> 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.

Try to remove CMakeCache.txt file and execute cmake with the wrong toolchain file. You should get warning. And then try the proper file name and search CMakeCache.txt for COMPILER.

Best regards,
Yegor


More information about the CMake mailing list