CMake Crosscompile nach embeded Linux

Gast #4029635
Lesenswert?

Ich sitze nun schon einige Zeit an CMake und versuche mein Programm auf 
ein embedded Linux crosscompilieren.

Meine Ordnerstruktur sieht folgendermassen aus:
1
Topdir/
2
  -CMakeLists.txt
3
  -toolchain-arm-angstrom-linux-gnueabi.cmake
4
  +build/
5
  +src/
6
    -CMakeLists.txt
7
    -sourcefiles.cpp
8
    -headerfiles.h
9
  +gen/
10
    -CMakeLists.txt
11
    -sourcefiles.cpp
12
    -headerfiles.h
13
  +libs/
14
    -CMakeLists.txt
15
    +subfolders/
Im buildverzeichnis rufe ich $ cmake .. auf und danach $ make. Dies 
funktioniert einwandfrei und ich kann nativ für x86 die Library builden.
Wenn ich aber mittels
1
$ cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-arm-angstrom-linux-gnueabi.cmake .. 
2
$ make
ausführe kommt folgende Fehlermeldung:
1
In file included from /home/user/cmake/topdir/src/ComponentImpl.h:11:0,
2
                 from /home/user/cmake/topdir/src/ComponentImpl.cpp:8:
3
/home/user/cmake/topdir/src/IComponent.hpp:11:18: fatal error: string: No such file or directory
4
compilation terminated.
5
make[2]: *** [CMakeFiles/topdir.dir/src/ComponentImpl.cpp.o] Error 1
6
make[1]: *** [CMakeFiles/topdir.dir/all] Error 2
7
make: *** [all] Error 2

Ich komme aber einfach nicht darauf woran das liegen kann. Anbei die 
erste CMakeLists.txt aus topdir/
1
# Minimal required CMake-Version
2
cmake_minimum_required(VERSION 2.6)
3

4
# Name project and select toolchain
5
project (IFM2-Infrastructure)
6
set(CMAKE_BUILD_TYPE Debug)
7
set(CMAKE_SYSTEM_NAME Linux)
8

9
# CMake should also search in this subfolders for CMakeLists
10
add_subdirectory(src)
11
add_subdirectory(gen)
12
add_subdirectory(libs)
13

14
# Include Files are located in
15
include_directories("src")
16
include_directories("gen")
17
include_directories("libs")
18

19
#Collect variable names from subdirs
20
set(libSrcs 
21
  ${library_IFM2SRC} 
22
  ${library_IFM2GEN} 
23
  ${library_IFM2LIBS} 
24
)
25

26
#Compiler flags
27
set(CMAKE_CXX_FLAGS "-g -Wall")
28
set(BUILD_SHARED_LIBS ON)
29

30
#create library and link it to other
31
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/out)
32
add_library(IFM2-Infrastructure SHARED ${libSrcs})
33
target_link_libraries(IFM2-Infrastructure -lrt -lpthread)

und das toolchain file
1
# this one is important
2
set(CMAKE_SYSTEM_NAME Linux)
3

4
INCLUDE(CMakeForceCompiler)
5
# specify the cross compiler
6
CMAKE_FORCE_C_COMPILER(/local/build/aba/bebuild21/toolchain/sysroots/i686-angstromsdk-linux/usr/bin/armv7ahf-vfp-neon-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-gcc GNU)
7
CMAKE_FORCE_CXX_COMPILER(/local/build/aba/bebuild21/toolchain/sysroots/i686-angstromsdk-linux/usr/bin/armv7ahf-vfp-neon-angstrom-linux-gnueabi/arm-angstrom-linux-gnueabi-g++ GNU)
8

9
# where is the target environment 
10
set(CMAKE_FIND_ROOT_PATH 
11
  /local/build/aba/bebuild21/toolchain/sysroots/armv7ahf-vfp-neon-angstrom-linux-gnueabi
12
)
13

14
# search for programs in the build host directories
15
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16
# for libraries and headers in the target directories
17
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
18
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Antwort schreiben

Bitte melde dich an, um einen Beitrag zu schreiben.

oder

Mit Google-Account einloggen

Die Registrierung ist kostenlos und dauert nur eine Minute.

Jetzt registrieren