Compilação cruzada para aplicações desenvolvidas com o CMake

Se você deseja fazer a compilação cruzada de um programa que usa o CMake para geração dos Makefiles, então você pode declarar o seguinte código no seu CMakeLists.txt :

INCLUDE(CMakeForceCompiler)

# this one is important
SET(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

#this one not so much
SET(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
SET(CMAKE_C_COMPILER   arm-eabi-gcc)
SET(CMAKE_CXX_COMPILER arm-eabi-g++)

SET(CMAKE_C_FLAGS "-nostdlib -I/workspace/android-imxt-r9.3/external/openssl/include")

# where is the target environment
SET(CMAKE_FIND_ROOT_PATH  /workspace/android-imxt-r9.3/prebuilt/linux-x86/toolchain/arm-eabi-4.4.0)

# search for programs in the build host directories
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# for libraries and headers in the target directories
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s