]> git.donarmstrong.com Git - kiibohd-controller.git/blob - Lib/CMake/initialize.cmake
Adding 72 MHz clock support for mk20dx256vlh7
[kiibohd-controller.git] / Lib / CMake / initialize.cmake
1 ###| CMAKE Kiibohd Controller Initialization |###
2 #
3 # Written by Jacob Alexander in 2011-2014 for the Kiibohd Controller
4 #
5 # Released into the Public Domain
6 #
7 ###
8
9
10 #| Windows / Cygwin Compatibility options
11 set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
12 set( CMAKE_USE_RELATIVE_PATHS  1 )
13
14
15 #| Prevent In-Source Builds
16 set( CMAKE_DISABLE_SOURCE_CHANGES  ON )
17 set( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
18
19
20 ###
21 # Compiler Lookup
22 #
23
24 #| avr match
25 if ( "${CHIP}" MATCHES "^at90usb.*$" OR "${CHIP}" MATCHES "^atmega.*$" )
26         set( COMPILER_FAMILY "avr" )
27
28 #| arm match
29 elseif ( "${CHIP}" MATCHES "^mk20dx.*$" )
30         set( COMPILER_FAMILY "arm" )
31
32 #| Invalid CHIP
33 else ()
34         message( FATAL_ERROR "CHIP: ${CHIP} - Unknown chip, could not choose compiler..." )
35 endif ()
36
37 #| Results of Compiler Lookup
38 message( STATUS "Compiler Family:" )
39 message( "${COMPILER_FAMILY}" )
40
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 )
45
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 .." )
49         endif()
50 endif ()
51
52 #| Load the compiler family specific configurations
53 include( ${COMPILER_FAMILY} )
54
55 #| Binutils not set by CMake
56 set( CMAKE_SIZE "${_CMAKE_TOOLCHAIN_PREFIX}size" )
57