queezythegreat/arduino-cmake — Issue #25: cc1plus: error: unrecognized command line option '-mmcu=atmega2560'
Author: erictj
Created: 2012-02-10 17:05:26+00:00
State: open

In trying to convert my project from the Arduino IDE over to using your cmake package, I get this:

$ make
[ 3%] Building CXX object CMakeFiles/mega2560_CORE.dir/usr/share/arduino-1.0/hardware/arduino/cores/arduino/USBCore.cpp.o
cc1plus: error: unrecognized command line option ‘-mmcu=atmega2560’
make[2]: *** [CMakeFiles/mega2560_CORE.dir/usr/share/arduino-1.0/hardware/arduino/cores/arduino/USBCore.cpp.o] Error 1
make[1]: *** [CMakeFiles/mega2560_CORE.dir/all] Error 2
make: *** [all] Error 2

Here is my CMakeLists.txt

#=============================================================================#
# Author: QueezyTheGreat #
# Date: 26.04.2011 #
# #
# Description: Arduino CMake example #
# #
#=============================================================================#
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) # CMake module search path
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/toolchains/Arduino.cmake) # Arduino Toolchain

cmake_minimum_required(VERSION 2.8)
#====================================================================#
# Setup Project #
#====================================================================#
project(ArduinoController C CXX)
find_package(Arduino 1.0 REQUIRED)
#link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
link_directories(/home/eric/sketchbook/libraries)

#====================================================================#
# Settings #
#====================================================================#
set(FIRMWARE_NAME arduino_controller)

set(${FIRMWARE_NAME}_BOARD mega2560) # Arduino Target board

set(${FIRMWARE_NAME}_HDRS Credentials.h) # Firmware headers
set(${FIRMWARE_NAME}_SRCS arduino_controller.ino) # Firmware sources

set(${FIRMWARE_NAME}_PORT /dev/ttyS0) # Serial upload port

set(${FIRMWARE_NAME}-serial picocom @INPUT_PORT@ -b 9600 -l)

#====================================================================#
# Target generation #
#====================================================================#
generate_arduino_firmware(${FIRMWARE_NAME})

#add_subdirectory(example) # Add example directory to build