IAR `CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID` not auto detected
CMake fails to autodetect CMAKE_<LANG>_COMPILER_ARCHITECTURE_ID
using IAR ANSI C/C++ Compiler V6.50.6.4896/W32 for ARM
The result is that CMake uses the gcc receipt failing with a confusing error message
Command line error: Unexpected command line arguments:
-c
NMAKE : fatal error U1077: 'C:\PROGRA~2\IARSYS~1\EMBEDD~1.5\arm\bin\iccarm.e
xe' : return code '0x2'
Stop.
!2353 (merged) contains a band aid fix failing earlier with a better error message.
What could be the root cause?
How does this work? https://gitlab.kitware.com/cmake/cmake/blob/master/Modules/CMakePlatformId.h.in#L152 Is iccarm.exe called with this C code? How? Does this call fail as well.
This is my CMAKE_TOOLCHAIN_FILE
### BEGIN CMAKE_TOOLCHAIN_FILE
# "Generic" is used when cross compiling
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_C_COMPILER_ARCHITECTURE_ID "ARM")
set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "ARM")
# Set toolkit root dir
set(EWARM_ROOT_DIR "C:/Program Files (x86)/IAR Systems/Embedded Workbench 6.5/arm")
# Compiler flags needed to compile for this CPU
set(CPU_FLAGS "--cpu Cortex-M4 --fpu=None --endian=little")
# Set up the compiler and assembler
set(CMAKE_C_COMPILER "${EWARM_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS}")
set(CMAKE_CXX_COMPILER "${EWARM_ROOT_DIR}/bin/iccarm.exe" "${CPU_FLAGS}")
set(CMAKE_ASM_COMPILER "${EWARM_ROOT_DIR}/bin/iasmarm.exe" "${CPU_FLAGS}")
# Set up the linker
set(LINKER_SCRIPT "${EWARM_ROOT_DIR}/config/linker/ST/str91xFx44.icf")
set(CMAKE_C_LINK_FLAGS "--semihosting --config \"${LINKER_SCRIPT}\"")
set(CMAKE_CXX_LINK_FLAGS "--semihosting --config \"${LINKER_SCRIPT}\"")
### END CMAKE_TOOLCHAIN_FILE