1 ###| CMAKE Kiibohd Controller Initialization |###
3 # Written by Jacob Alexander in 2011-2014 for the Kiibohd Controller
5 # Released into the Public Domain
10 #| Windows / Cygwin Compatibility options
11 set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
12 set( CMAKE_USE_RELATIVE_PATHS 1 )
15 #| Prevent In-Source Builds
16 set( CMAKE_DISABLE_SOURCE_CHANGES ON )
17 set( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
25 if ( "${CHIP}" MATCHES "^at90usb.*$" OR "${CHIP}" MATCHES "^atmega.*$" )
26 set( COMPILER_FAMILY "avr" )
29 elseif ( "${CHIP}" MATCHES "^mk20dx.*$" )
30 set( COMPILER_FAMILY "arm" )
34 message( FATAL_ERROR "CHIP: ${CHIP} - Unknown chip, could not choose compiler..." )
37 #| Results of Compiler Lookup
38 message( STATUS "Compiler Family:" )
39 message( "${COMPILER_FAMILY}" )
41 #| Compiler Selection Record
42 #| This is used to check if the chip target has changed (a complete cmake reset is needed)
43 if ( EXISTS compiler )
44 file( READ ${CMAKE_BINARY_DIR}/compiler COMPILER_RECORD )
46 # Detect case if a full cmake reset is required
47 if ( NOT COMPILER_FAMILY STREQUAL COMPILER_RECORD )
48 message( FATAL_ERROR "Changing compilers requires a cmake reset\ne.g. rm -rf *; cmake .." )
52 #| Load the compiler family specific configurations
53 include( ${COMPILER_FAMILY} )
55 #| Binutils not set by CMake
56 set( CMAKE_SIZE "${_CMAKE_TOOLCHAIN_PREFIX}size" )