[CMake] is it worth using cmake to cross-compile for embedded arm device?

Gunter, Walter E Walter.Gunter at dematic.com
Wed Oct 19 12:57:49 EDT 2016


The toolchain was a great suggestion.

I am still having problems, but at least I know I am using the right toolchain:
Currently, this is what I have for my toolchain:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(TOOLCHAIN_PATH /opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi)

# where is the target environment
set(CMAKE_FIND_ROOT_PATH /opt/toolchains/arm-2008q3/arm-none-linux-gnueabi)

# specify the cross compiler
set(CMAKE_CXX_COMPILER /opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-g++)
set(CMAKE_C_COMPILER /opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-gcc)

#set(CMAKE_AR /opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-ar)

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

set(COMPILE_FLAGS "-lrt -Wall -lpthread")


I run cmake with the reference to that toolchain file, cmake –DCMAKE_TOOLCHAIN_FILE=cmake/toolchain.cmake

I can see it finds the right toolchain and compilers.
Now I am having some issues where it is getting conflicted between using sys or linux headers….
Is this just a header issue?

CMAKE question:  What is the difference between the two variables?
TOOLCHAIN_PATH
CMAKE_FIND_ROOT_PATH
Should they be the same reference location?

This is the folder structure at the /opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi
/bin
/include
/lib
/libc

Thoughts?

Thanks!

From: dflogeras at gmail.com [mailto:dflogeras at gmail.com] On Behalf Of Dave Flogeras
Sent: Friday, September 16, 2016 5:43 PM
To: Gunter, Walter E
Subject: Re: [CMake] is it worth using cmake to cross-compile for embedded arm device?

I personally use cmake with multiple cross toolchains successfully.  I guess it depends on what you are trying to achieve.  I prefer it because I can use the same CMakeLists.txt to build natively on linux/mac/windows, as well as cross-compile against an embedded arm linux.  I'd also agree with the previous discussion about using a toolchain file for your platform, it does simplify things.

On Fri, Sep 16, 2016 at 5:26 PM, Gunter, Walter E <Walter.Gunter at dematic.com<mailto:Walter.Gunter at dematic.com>> wrote:
I am having some troubles getting cmake setup and wonder if cmake is the right tool.
Thoughts? Suggestions?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161019/ba626b1c/attachment.html>


More information about the CMake mailing list