[CMake] Errors using CMAKE for cross compiling.
Kishore
kitts.mailinglists at gmail.com
Tue Jun 14 00:47:52 EDT 2011
On Tuesday 14 Jun 2011 9:46:56 AM jianhua wrote:
> 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})
The above cross compiler settings should occur before the PROJECT() statement
and ideally in a toolchain file. For start, just move the above PROJECT()
statement to the place of this comment and try again.
> 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)
--
Cheers!
Kishore
More information about the CMake
mailing list