cmake_minimum_required(VERSION 2.6) # or other version project (foo C) add_definitions(-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -flto -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -c -std=gnu99) add_definitions(-mmcu=atmega88) list(APPEND MY_LINKER_FLAGS "-mmcu=atmega88 -flto") add_executable(foo foo.c) add_definitions(-O0) set_target_properties(foo PROPERTIES SUFFIX ".elf")