[CMake] The problem of Cross Compilation for ARM with use yagarto.

Denis Shienkov scapig2 at yandex.ru
Sat Mar 24 11:27:46 EDT 2012


Hi, CMake developers.

I have a problem with cross-compiling for ARM7 simple program like:

int main()
{
     return 0;
}

To building I use the toolchain as yagarto: http://www.yagarto.de/

The problem is that the build with Yagarto need to use LDFLAGS + = 
"-nostartfiles"

But during testing CMake compiler, by default tries to compile the test 
code without this flag.
Therefore, testing of the compiler fails.

I have toolchain.cmake file with content:

SET (CMAKE_SYSTEM_NAME Generic)
SET (CMAKE_SYSTEM_VERSION 1)
SET (CMAKE_SYSTEM_PROCESSOR arm7tdmi)
SET_PROPERTY(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)

SET (DEVROOT "c:/yagarto/toolchain")

SET (CMAKE_C_COMPILER "${DEVROOT}/bin/arm-none-eabi-gcc.exe")
SET (CMAKE_CXX_COMPILER "${DEVROOT}/bin/arm-none-eabi-g++.exe")

SET (CMAKE_C_FLAGS "-nostartfiles")
SET (CMAKE_CXX_FLAGS "-nostartfiles")
SET (CMAKE_EXE_LINKER_FLAGS "-nostartfiles")

INCLUDE_DIRECTORIES(SYSTEM "${DEVROOT}/arm-none-eabi/include")
LINK_DIRECTORIES("${DEVROOT}/arm-none-eabi/lib")

SET (CMAKE_FIND_ROOT_PATH "${DEVROOT}" )
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

And CMaleLists.txt with content:

PROJECT(TEST)

cmake_minimum_required(VERSION 2.8)
ADD_EXECUTABLE(test main.c)
target_link_libraries(test)


Tell me, is there any solution to this problem? How do I add this LDFLAG 
at the testing stage?
Or maybe there is another solution?

Best regards,
Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120324/2953c438/attachment.htm>


More information about the CMake mailing list