IAR: Improve error message for missing license
When using the IAR Compiler without a license, CMake issues a fatal error message about a missing linker and librarian. This message is misleading.
user@host:~/project$ cmake -Bbuild -GNinja --toolchain bxarm.cmake
-- The C compiler identification is IAR
CMake Error at /usr/local/share/cmake-3.30/Modules/CMakeFindBinUtils.cmake:157 (message):
Failed to find linker and librarian for IAR on .
Call Stack (most recent call first):
/usr/local/share/cmake-3.30/Modules/CMakeDetermineCCompiler.cmake:201 (include)
CMakeLists.txt:5 (project)
-- Configuring incomplete, errors occurred!
In the previous detection, CMakeFindBinUtils.cmake would rely on information collected from try_compile()
which depends on a working license.
In the new detection scheme, the IAR BinUtils are automatically detected regardless of an existing license, based solely on the compiler's path.
The failure point will be when trying to compile a C
or a CXX
source file, where there will be no CMAKE_${lang}_COMPILER_VERSION
available.
This change improves the resulting fatal error message for when trying to use the compiler without a working license:
CMake Error at /usr/local/share/cmake-3.30/Modules/Compiler/IAR-C.cmake:14 (message):
Could not detect CMAKE_C_COMPILER_VERSION. This should be automatic.
Check your product license.
Call Stack (most recent call first):
/usr/local/share/cmake-3.30/Modules/CMakeCInformation.cmake:25 (include)
CMakeLists.txt:5 (project)