diff --git a/CMakeLists.txt b/CMakeLists.txt index cc58e40efed6..e18f607be84e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -222,7 +222,7 @@ if(CMAKE_COMPILER_IS_CLANG) endif(CMAKE_COMPILER_IS_CLANG) if(CMAKE_COMPILER_IS_IAR) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts --warnings_are_errors -Ohz") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warn_about_c_style_casts -Ohz") endif(CMAKE_COMPILER_IS_IAR) if(CMAKE_COMPILER_IS_MSVC) @@ -243,6 +243,10 @@ if(MBEDTLS_FATAL_WARNINGS) set(CMAKE_C_FLAGS_ASANDBG "${CMAKE_C_FLAGS_ASANDBG} -Wno-error=cpp") endif(UNSAFE_BUILD) endif(CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNU) + + if (CMAKE_COMPILER_IS_IAR) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --warning_are_errors") + endif(CMAKE_COMPILER_IS_IAR) endif(MBEDTLS_FATAL_WARNINGS) if(CMAKE_BUILD_TYPE STREQUAL "Coverage") diff --git a/ChangeLog.d/fix_cmake_using_iar_toolchain.txt b/ChangeLog.d/fix_cmake_using_iar_toolchain.txt new file mode 100644 index 000000000000..ecc09c241e3f --- /dev/null +++ b/ChangeLog.d/fix_cmake_using_iar_toolchain.txt @@ -0,0 +1,3 @@ +Bugfix + * Fixed an issue that cause compile error using CMake IAR toolchain. + Fixes #5964.