diff options
author | Brad King <brad.king@kitware.com> | 2018-09-11 12:31:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-09-11 12:31:19 (GMT) |
commit | 528d7625b89e0343bbf541edd256971493a6e455 (patch) | |
tree | 869687af7cc9e336e42664c2812abcb4680fdbf1 | |
parent | 9a5b04a5f6cc3f6e8e35b9b2e6858406c4ecf4a1 (diff) | |
parent | a26ebb894b192b0156f6a0802ecc4b1f872fcff3 (diff) | |
download | CMake-528d7625b89e0343bbf541edd256971493a6e455.zip CMake-528d7625b89e0343bbf541edd256971493a6e455.tar.gz CMake-528d7625b89e0343bbf541edd256971493a6e455.tar.bz2 |
Merge topic 'iar-fail-early'
a26ebb894b IAR: Abort if compiler version or target architecture is not detected
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2353
-rw-r--r-- | Modules/Compiler/IAR-ASM.cmake | 2 | ||||
-rw-r--r-- | Modules/Compiler/IAR-C.cmake | 6 | ||||
-rw-r--r-- | Modules/Compiler/IAR-CXX.cmake | 6 |
3 files changed, 14 insertions, 0 deletions
diff --git a/Modules/Compiler/IAR-ASM.cmake b/Modules/Compiler/IAR-ASM.cmake index 651bc3a..e12bfd1 100644 --- a/Modules/Compiler/IAR-ASM.cmake +++ b/Modules/Compiler/IAR-ASM.cmake @@ -18,4 +18,6 @@ elseif("${CMAKE_ASM${ASM_DIALECT}_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") __compiler_iar_AVR(ASM) 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() diff --git a/Modules/Compiler/IAR-C.cmake b/Modules/Compiler/IAR-C.cmake index 55e019e..2ed8818 100644 --- a/Modules/Compiler/IAR-C.cmake +++ b/Modules/Compiler/IAR-C.cmake @@ -5,6 +5,9 @@ include(Compiler/CMakeCommonCompilerMacros) # The toolchains for ARM and AVR are quite different: 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) @@ -40,4 +43,7 @@ elseif("${CMAKE_C_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) include_directories("${_compilerDir}/inc" ) + +else() + message(FATAL_ERROR "CMAKE_C_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic.") endif() diff --git a/Modules/Compiler/IAR-CXX.cmake b/Modules/Compiler/IAR-CXX.cmake index 8d86100..5b783b2 100644 --- a/Modules/Compiler/IAR-CXX.cmake +++ b/Modules/Compiler/IAR-CXX.cmake @@ -10,6 +10,9 @@ if("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "ARM") # # --c++ is full C++ and supported since 6.10 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) set(CMAKE_IAR_CXX_FLAG --c++) else() @@ -48,4 +51,7 @@ elseif("${CMAKE_CXX_COMPILER_ARCHITECTURE_ID}" STREQUAL "AVR") get_filename_component(_compilerDir "${CMAKE_C_COMPILER}" PATH) get_filename_component(_compilerDir "${_compilerDir}" PATH) include_directories("${_compilerDir}/inc") + +else() + message(FATAL_ERROR "CMAKE_CXX_COMPILER_ARCHITECTURE_ID not detected as \"AVR\" or \"ARM\". This should be automatic." ) endif() |