[CMake] Errors using CMAKE for cross compiling.

jianhua yujianhua1982 at 126.com
Mon Jun 13 21:46:56 EDT 2011


Try cross compiling using CMAKE, target tool chain is ARM RVCT4, got errors on both Windows and Ubuntu.

Please help, thanks in advance. 

1. On Ubuntu.
 ADD_EXECUTABLE(hello main.c)  
Fatal error: C3900U: Unrecognized option '-rdynamic'.   

ADD_EXECUTABLE(hello SHARED main.c)  
Fatal error: C3900U: Unrecognized option '-fPIC'.   

My question:
I don't know why such compiling options have been added automatically by CMAKE? armcc doesn't recognize it.

2. On Windows XP.
My Question:
I have set CMAKE_C_COMPILER already, why does it still can't find it?

G:\t2\build>cmake -G "Unix Makefiles"  VERBOSE=1 .. && make VERBOSE=1
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error: your C compiler: "CMAKE_C_COMPILER-NOTFOUND" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: your CXX compiler: "CMAKE_CXX_COMPILER-NOTFOUND" was not found.   Please set CMAKE_CXX_COMPILER to a valid compiler path or name.


CMakeLists:

cmake_minimum_required(VERSION 2.8)
PROJECT (HELLO)

set(RVCT40BIN  $ENV{RVCT40BIN})
set(RVCT40INC  $ENV{RVCT40INC})
set(RVCT40LIB  $ENV{RVCT40LIB})

SET (CMAKE_SYSTEM_PROCESSOR arm)
SET (CMAKE_CROSSCOMPILING 1)

SET(CMAKE_C_COMPILER  ${RVCT40BIN}/armcc)
SET(CMAKE_CXX_COMPILER  ${CMAKE_C_COMPILER})   

SET (CMAKE_C_FLAGS  "--thumb --cpp -c --cpu ARM9TDMI --apcs /noropi/interwork/norwpi --littleend --split_sections   --diag_suppress 177,1165,997,611,68,161,2548 --fpu=softvfp -Ospace -O2")
SET (CMAKE_CXX_FLAGS ${CMAKE_C_FLAGS})

SET (CMAKE_C_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <LINK_FLAGS> <TARGET> <OBJECTS>")
SET (CMAKE_CXX_CREATE_STATIC_LIBRARY "<CMAKE_AR> --create -cr <LINK_FLAGS> <TARGET> <OBJECTS>")

INCLUDE_DIRECTORIES(${RVCT40INC})
LINK_DIRECTORIES(${RVCT40LIB}/armlib  ${RVCT40LIB}/cpplib)
ADD_EXECUTABLE(hello main.c)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110614/b3e9fc01/attachment.htm>


More information about the CMake mailing list