[CMake] Problem using CMake for cross compiling for linux

Thomas Baag baag at ice.rwth-aachen.de
Thu Nov 28 10:05:18 EST 2013


Hi folks,

i'm trying to cross compile a simple hello world on Scientific Linux 6.4 
(amd64) using cmake version 2.8.4 and arm-none-eabi-gcc 4.8.1. I've 
encountered the well known "-rdynamic" problem[1], but couldn't manage to 
apply a nice workaround.

I DONT want to disable simple compiler checks. The problem seems to be in the 
"__linux_compiler_gnu" macro in "Modules/Platform/Linux-GNU.cmake".

Until now i tried 
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
before and after "PROJECT(...)", but it didn't work.
After that, I added this on top of my CMakeList.txt:
SET(__LINUX_COMPILER_GNU 1)
MACRO(__linux_compiler_gnu lang)
 SET(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
ENDMACRO()
But it also didnt work.

Now i'm somehow out of ideas. Could anyone pls help?


Greetings
Thomas

[1] http://www.cmake.org/Bug/view.php?id=9985


================
# Minimal CMakeList.txt:
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

SET(__LINUX_COMPILER_GNU 1)
MACRO(__linux_compiler_gnu lang)
 SET(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "")
ENDMACRO()

PROJECT(Build-Example)

================
# Minimal toolchain file:
SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_PROCESSOR "armv7")
SET(CMAKE_C_COMPILER arm-none-eabi-gcc)



More information about the CMake mailing list