Okay…that made a huge difference.

Just moving those set commands to a separate toolchain.cmake file worked.  Even 
though the commands were the same, and I had the CMAKE_FIND_ROOT_PATH at the 
top of the toplevel CMakeLists.txt before project:

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

and then had all the settings that I moved into the toolchain.cmake file.
The difference came from moving the cross compile settings I had in the top 
level CMakeLists.txt to the myhardware_toolchain.cmake.
Now, I added the CMAKE_TOOLCHAIN_FILE to the toplevel CMakeLists.txt at the top 
(right under cmake_minimum_required 3.2) and the output of cmake is now looking 
right:

#set toolchain to use
set(CMAKE_TOOLCHAIN_FILE cmake/myHardware_toolchain.cmake)

>cmake ../projectFolder
-- The C compiler identification is GNU 4.3.2
-- The CXX compiler identification is GNU 4.3.2
-- Check for working C compiler: 
/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-gcc
-- Check for working C compiler: 
/opt/toolchains/arm-2008q3/bin/arm-none-linux-gnueabi-gcc -- works



Now to see why it doesn’t make…. It is getting hung up on some of the includes 
that should be fine.
Any suggestions on why when including
#include <linux/can.h>
The compiler has an issue with using its own linux headers from the toolchain?



From: dfloge...@gmail.com [mailto:dfloge...@gmail.com] On Behalf Of Dave 
Flogeras
Sent: Friday, September 16, 2016 3: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.gun...@dematic.com<mailto:walter.gun...@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

Reply via email to