[CMake] Cross compiling arm-elf on Windows host

Harald Kipp harald.kipp at egnite.de
Sun Sep 20 12:11:11 EDT 2009


Hi all,

I'm considering CMake for our Ethernut project
http://www.ethernut.de

In a first step I tried to build a simple library for an arm-elf target.
I tried to follow
http://www.itk.org/Wiki/CMake_Cross_Compiling
as well as
http://www.itk.org/Wiki/CmakeEcos

Unfortunately nothing worked here. :-(

The eCos sample is obviously targeted for Linux hosts.

After several hours of trial and error I managed to get a few things
working, but still no library build.

I decided to cut everything back to pure minimum.

My toolchain file:

--- C:\ethernut-4.9.6\toolchain-generic.cmake ---
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_SYSTEM_PROCESSOR arm7tdmi)
CMAKE_FORCE_C_COMPILER(arm-elf-gcc GNU)
CMAKE_FORCE_CXX_COMPILER(arm-elf-g++ GNU)
-------------------------------------------------

My top CMakeLists:

--- C:\ethernut-4.9.6\nut\CMakeLists.txt ---
cmake_minimum_required(VERSION 2.6)
add_subdirectory(fs)
--------------------------------------------

My subdir CMakeLists:

--- C:\ethernut-4.9.6\nut\fs\CMakeLists.txt ---
add_library(nutfs STATIC basename dirent dirname)
-----------------------------------------------

My command sequence:

 cd C:\ethernut-4.9.6
 mkdir nutbld
 cd nutbld

then

 cmake -G "Unix Makefiles"
-DCMAKE_TOOLCHAIN_FILE=c:\ethernut-4.9.6\toolchain-generic.cmake
c:\ethernut-4.9.6\nut

So far the result is

 -- Configuring done
 -- Generating done
 -- Build files have been written to: C:/ethernut-4.9.6/nutbld

However, when trying to run make, I get

  Scanning dependencies of target nutfs
  [ 33%] Building C object fs/CMakeFiles/nutfs.dir/basename.c.obj
  Das System kann den angegebenen Pfad nicht finden.
  make[2]: *** [fs/CMakeFiles/nutfs.dir/basename.c.obj] Error 1
  make[1]: *** [fs/CMakeFiles/nutfs.dir/all] Error 2
  make: *** [all] Error 2

Furthermore, when

 cd fs
 make -n

gives

  cd C:/ethernut-4.9.6/nutbld && "C:/Programm....

I think that this will not work on Windows. cd requires backslashes.

Many thanks for your help in advance,

Harald



More information about the CMake mailing list