[CMake] specifying linker for cross-compilation
Guraaf
guraaf at gmail.com
Tue May 19 16:19:09 EDT 2015
Further to my earlier question, I spent more time on:
http://www.cmake.org/Wiki/CMake_Cross_Compiling
but still couldn't get the linker to work. I now have two files:
arm.cmake
INCLUDE(CMakeForceCompiler)
SET(CMAKE_SYSTEM_NAME Generic)
CMAKE_FORCE_C_COMPILER(armcc GNU)
SET(CMAKE_ASM_COMPILER armasm)
SET(CMAKE_AR armar)
SET(CMAKE_LINKER armlink)
SET(CMAKE_C_FLAGS "--cpu=Cortex-M3")
SET(CMAKE_AR_FLAGS "-armcc,-Ospace")
SET(CMAKE_C_LINK_FLAGS "--map --ro-base=0x0 --rw-base=0x0008000
--first='boot.o(RESET)' --datacompressor=off")
SET(CMAKE_C_LINK_EXECUTABLE="<CMAKE_LINKER> <FLAGS> ${CMAKE_C_LINK_FLAGS}
<LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
and my CMakeLists.txt:
cmake_minimum_required(VERSION 2.8)
project(test_arm)
add_executable( blinky blinky.c )
However, the armlink is never invoked. Make still wants to link via "armcc"
and never calls armlink. What am I doing wrong for getting a specific
linker with specific flags to work?
$ mkdir build
$ cd build
$ cmake -DCMAKE_TOOLCHAIN_FILE=../arm.cmake ..
$ make VERBOSE=1
Thanks a lot!
----
Guraaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150519/eebe4246/attachment.html>
More information about the CMake
mailing list