]> git.donarmstrong.com Git - kiibohd-controller.git/blobdiff - Lib/CMake/initialize.cmake
Adding basic remote capabilities + UART Rx DMA buffers
[kiibohd-controller.git] / Lib / CMake / initialize.cmake
index 9f01b3a43221387ae9282ea5f4a4b8ca29d59132..ba370bc1885e8df516029d1a9d34797b642305f4 100644 (file)
@@ -12,6 +12,10 @@ set( CMAKE_LEGACY_CYGWIN_WIN32 0 )
 set( CMAKE_USE_RELATIVE_PATHS  1 )
 
 
+#| Prevent In-Source Builds
+set( CMAKE_DISABLE_SOURCE_CHANGES  ON )
+set( CMAKE_DISABLE_IN_SOURCE_BUILD ON )
+
 
 ###
 # Compiler Lookup
@@ -34,8 +38,19 @@ endif ()
 message( STATUS "Compiler Family:" )
 message( "${COMPILER_FAMILY}" )
 
+#| Compiler Selection Record
+#|  This is used to check if the chip target has changed (a complete cmake reset is needed)
+if ( EXISTS compiler )
+       file( READ ${CMAKE_BINARY_DIR}/compiler COMPILER_RECORD )
+
+       # Detect case if a full cmake reset is required
+       if ( NOT COMPILER_FAMILY STREQUAL COMPILER_RECORD )
+               message( FATAL_ERROR "Changing compilers requires a cmake reset\ne.g. rm -rf *; cmake .." )
+       endif()
+endif ()
+
 #| Load the compiler family specific configurations
-include( Lib/CMake/${COMPILER_FAMILY}.cmake )
+include( ${COMPILER_FAMILY} )
 
 #| Binutils not set by CMake
 set( CMAKE_SIZE "${_CMAKE_TOOLCHAIN_PREFIX}size" )