This page explains how to cross-compile and link to the arduino core lib using cmake/avr-gcc
This tarball has a dir structure and example file for building with cmake: Attach:ArduinoProject.zip (derived from arduino-0016 linux)
Intended to be used by people who are writing largish projects for the arduino, people who can't get the standard IDE to work, people who really like a certain text editor, or people who would like to emit a single "make" to build a large number of projects. Spawned from frustrations opening many header files in the default arduino IDE.
General Instructions
Console upload instructions:
The following settings allow cmake to cross-compile for the ATmega168. They should be put in the top of every file, or in an include file.
SET(CMAKE_SYSTEM_NAME Generic)
SET(CMAKE_C_COMPILER avr-gcc)
SET(CMAKE_CXX_COMPILER avr-g++)
SET(CSTANDARD "-std=gnu99")
SET(CDEBUG "-gstabs")
SET(CWARN "-Wall -Wstrict-prototypes")
SET(CTUNING "-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums")
SET(COPT "-Os")
SET(CINCS "-I${Candi_SOURCE_DIR}/libarduino")
SET(CMCU "-mmcu=atmega168")
SET(CDEFS "-DF_CPU=16000000")
SET(CFLAGS "${CMCU} ${CDEBUG} ${CDEFS} ${CINCS} ${COPT} ${CWARN} ${CSTANDARD} ${CEXTRA}")
SET(CXXFLAGS "${CMCU} ${CDEFS} ${CINCS} ${COPT}")
SET(CMAKE_C_FLAGS ${CFLAGS})
SET(CMAKE_CXX_FLAGS ${CXXFLAGS})
Complements of the Georgia Tech IGVC Team - JS