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

J Decker d3ck0r at gmail.com
Wed Oct 19 14:09:45 EDT 2016


to gcc you can pass --sysroot which will bias it's internal referenced
includes and libraries....

On Wed, Oct 19, 2016 at 9:57 AM, Gunter, Walter E <Walter.Gunter at dematic.com
> wrote:

> 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> wrote:
>
> I am having some troubles getting cmake setup and wonder if cmake is the
> right tool.
>
> Thoughts? Suggestions?
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161019/d2647d61/attachment-0001.html>


More information about the CMake mailing list