Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Copyright (C) 2011 Devin DeLong
- #
- # This program is free software: you can redistribute it and/or modify
- # it under the terms of the GNU General Public License as published by
- # the Free Software Foundation, either version 3 of the License, or
- # (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
- # This module defines macros intended for use by cross-compiling toolchain files when
- # CMake is not able to automatically detect the compiler identification.
- include (CMakeForceCompiler)
- # Set this for cross compiling. Otherwise it is set to CMAKE_HOST_SYSTEM_NAME,
- # which is the system we are developing on.
- set (CMAKE_SYSTEM_NAME Generic)
- # It sets CMAKE_<lang>_COMPILER to the given compiler and the cmake internal variable
- # CMAKE_<lang>_COMPILER_ID to the given compiler-id. It also bypasses the check for
- # working compiler and basic compiler information tests.
- cmake_force_cxx_compiler (avr-g++ CrossAVR)
- cmake_force_c_compiler (avr-gcc CrossAVR)
- # Appparently we want to use the gnuc99 standard.
- set (CSTANDARD "-std=gnu99")
- # Generate .stabs debugging symbols for assembler source lines. This enables avr-gdb to
- # trace through assembler source files.
- set (CDEBUG "-gstabs")
- # Warn for functions declared or defined without specified argument types.
- set (CWARN "-Wall -Wstrict-prototypes")
- # -funsigned-char - Make any unqualfied char type an unsigned char. Without this option,
- # they default to a signed char.
- # -funsigned-bitfields - Make any unqualified bitfield type unsigned. By default,
- # they are signed.
- # -fpack-struct - Pack all structure members together without holes.
- # -fshort-enums - Allocate to an enum type only as many bytes as it needs for the declared
- # range of possible values. Specifically, the enum type will be equivalent to the
- # smallest integer type which has enough room.
- set (CTUNING_FLAGS "-funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums")
- # Optimize for size. The special option -Os is meant to turn on all -O2 optimizations
- # that are not expected to increase code size.
- set (COPT "-Os")
- # Finally the compilation flags are now configured.
- set(CMAKE_CXX_FLAGS "-mmcu=${ARDUINO_PROCESSOR} -DF_CPU=${ARDUINO_PROCESSOR_FREQ} ${COPT}")
- set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} ${CTUNING_FLAGS} ${CWARN} ${CSTANDARD} ${CDEBUG}")
- # On gentoo, -rdynamic is passed to the compiler. The avr compiler does not recognize this
- # option. Also, we are not building shared libraries.
- set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement