[CMake] trouble with cmake 2.6-patch 0 cross compiling.

Phil Pellouchoud Phil at slacker.com
Wed Jul 16 14:23:45 EDT 2008


I waited for a while to get this e-mail through, but it didn't seem like it took - trying again.

----

Hi.

I've got cmake 2.6-patch 0 installed and I'm trying to get a simple (helloworld.cpp) compiled and built on a linux system.

My toolchain file looks like this:

-- toolchain.cmake --
SET( CMAKE_SYSTEM_NAME foobar )
SET( CMAKE_SYST EM_VERSION 1 )
SET( CMAKE_SYSTEM_PROCESSOR arm-foo )
SET( CMAKE_SYSTEM_C_COMPILER /absolute/path/to/compiler )
SET( CMAKE_SYSTEM_CXX_COMPILER /absolute/path/to/compiler )
SET( CMAKE_FIND_ROOT_PATH /absolute/path/to/compiler/tools )

SET( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
SET( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
SET( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )

My CMakeLists.txt file looks like this:
-- CMakeLists.txt --
PROJECT( helloworld )
CMAKE_MINIMUM_REQUIRED( VERSION 2.6 )
ADD_EXECUTABLE( helloworld helloworld.cpp )

My "Platform/foobar.cmake" exists, but is empty.

My cmake command looks like this:
$ cmake -DCMAKE_TOOLCHAIN_FILE=toolchain.cmake ..

That works without any error messages.  I can do a "make" and it builds the program, but I am able to run it - which I shouldn't be able to do.  Just to be sure, I manually compiled helloworld.cpp (without cmake) and when I tried to execute it, it rightfully detected the binary was not compatible.

Furthermore, when I looked at CMakeCache.txt, I see
CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc

Any help would be greatly appreciated.

Thanks.

-phil

p.s. I did first search the mailing lists and I consulted http://www.cmake.org/Wiki/CMake_Cross_Compiling#The_toolchain_file first as well.

Keywords: cmake, 2.6, cross compiling, linux, arm, toolchain


More information about the CMake mailing list