I am attempting to replicate the following behaviour in CMake and need a little assistance...
I am compiling using gcc then linking using ld explicity. The original makefile carries out the following:
arm-linux-gcc -MD -Wa,-mcpu=arm7tdmi -Dgcc -c init.S arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c serial.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c timer.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c amd.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c intel.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c at25f1024.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c sst25vf020.c arm-linux-gcc -MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -c main.c arm-linux-ld -q --defsym ROBASE=0x00000000 -T init.lds -o init.elf init.o serial.o timer.o amd.o intel.o at25f1024.o sst25vf020.o main.o My CMakefileLists.txt looks like this
cmake_minimum_required(VERSION 2.8) project(bootStage2) #add_definitions(ROBASE set(CMAKE_C_FLAGS "-MD -Wall -fno-common -fshort-enums -mcpu=arm7tdmi -fno-builtin -mapcs -O2 -Wl,-q -Wl,--defsym=ROBASE=0x00000000 -T ${bootStage2_SOURCE_DIR}/init.lds") #add_definitions(ROBASE=0x00000000) set(SRCFILES serial.c timer.c amd.c intel.c at25f1024.c sst25vf020.c main.c ) set(CMAKE_init.elf_LINK_EXECUTABLE "/usr/bob/arm920t/usr/bin/arm-linux-ld") add_executable( init.elf ${SRCFILES}) SET_TARGET_PROPERTIES(init.elf PROPERTIES LINKER_LANGUAGE C) add_dependencies( init.elf assemble_S ) add_custom_target(assemble_S COMMAND /usr/bob/arm920t/usr/bin/arm-linux-gcc -MD -Wa,-mcpu=arm7tdmi -Dgcc -c init.S COMMENT "Assembling init.S" WORKING_DIRECTORY ${bootStage2_SOURCE_DIR} If I don't define the linker exe then CMake attempts to use gcc to link and seg faults on linking.
The cmake output complains that there are no files to link against when I tell it to use arm-linux-ld, I'm sure there is a better way of doing this does anyone have any useful hints?
Cheers,
Chris.
CC=/usr/bob/arm920t/usr/bin/arm-linux-gcc cmake ../path/to/src?