Commit 528d7625 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'iar-fail-early'

a26ebb89

 IAR: Abort if compiler version or target architecture is not detected
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !2353
parents 9a5b04a5 a26ebb89
...@@ -18,4 +18,6 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") ...@@ -18,4 +18,6 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
__compiler_iar_AVR(ASM) __compiler_iar_AVR(ASM)
set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa) set(CMAKE_ASM_SOURCE_FILE_EXTENSIONS s90;asm;msa)
else()
message(FATAL_ERROR "CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
endif() endif()
...@@ -5,6 +5,9 @@ include(Compiler/CMakeCommonCompilerMacros) ...@@ -5,6 +5,9 @@ include(Compiler/CMakeCommonCompilerMacros)
# The toolchains for ARM and AVR are quite different: # The toolchains for ARM and AVR are quite different:
if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") if("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
if(NOT CMAKE_C_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_C_COMPILER_VERSION not detected. This should be automatic.")
endif()
set(CMAKE_C_EXTENSION_COMPILE_OPTION -e) set(CMAKE_C_EXTENSION_COMPILE_OPTION -e)
...@@ -40,4 +43,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") ...@@ -40,4 +43,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc" ) include_directories("${_compilerDir}/inc" )
else()
message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.")
endif() endif()
...@@ -10,6 +10,9 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") ...@@ -10,6 +10,9 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM")
# #
# --c++ is full C++ and supported since 6.10 # --c++ is full C++ and supported since 6.10
if(NOT CMAKE_IAR_CXX_FLAG) if(NOT CMAKE_IAR_CXX_FLAG)
if(NOT CMAKE_CXX_COMPILER_VERSION)
message(FATAL_ERROR "CMAKE_CXX_COMPILER_VERSION not detected. This should be automatic.")
endif()
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10) if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.10)
set(CMAKE_IAR_CXX_FLAG --c++) set(CMAKE_IAR_CXX_FLAG --c++)
else() else()
...@@ -48,4 +51,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") ...@@ -48,4 +51,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR")
get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH)
get_filename_component(_compilerDir "${_compilerDir}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH)
include_directories("${_compilerDir}/inc") include_directories("${_compilerDir}/inc")
else()
message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." )
endif() endif()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment