Target "unity" requires the language dialect "C11"

Code build is working fine with CMake Version 3.19 but when version upgrade onward, It is showing below error, any suggestion
Error: Target “unity” requires the language dialect “C11” . But the current compiler “IAR” does not support this, or CMake does not know the flags to enable it.

I had checked all release note, not getting any proper solution. To build code, either I need to comment “#C_STANDARD 11” or “C_STANDARD_REQUIRED OFF”

Any suggestion is highly appreciated

There have been changes affecting the IAR compiler in recent releases, some of which caused regressions but I believe have since been fixed. It looks like things may have been broken in CMake 3.22, but the changes in MR 7053 should have restored things to a working state for CMake 3.23 and later. Can you please try out the latest CMake release and see if that has fixed your issues?

If the latest release still doesn’t work for you, please provide details of the compiler you are using (full version, etc.), what platform you are building for, any toolchain file you are using, any other details that may help people understand the environment you’re building in and for, etc.

Dear Craig,
Thank you for your quick support.
Issue is still with latest version cmake-3.24.1-windows-x86_64.

IAR compiler : 8.4.1 (EWARM-CD-8422-24293)

Toolchain details:


if ("${ROOT_DIR}" STREQUAL "")
	set(ROOT_DIR "C:/Program\ Files\ (x86)/IAR\ Systems/Embedded\ Workbench\ 8.4/arm")


set(CMAKE_C_COMPILER "${ROOT_DIR}/bin/iccarm.exe" )
set(CMAKE_CXX_COMPILER "${ROOT_DIR}/bin/iccarm.exe" )
set(CMAKE_ASM_COMPILER "${ROOT_DIR}/bin/iasmarm.exe" )

set(CMAKE_C_FLAGS "--thumb")
set(CMAKE_CXX_FLAGS "--thumb")
set(CMAKE_ASM_FLAGS "--thumb")

I am using using Jenkin, eclipse as well as console

console build:

cmake -DCMAKE_BUILD_TYPE:STRING=Target -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON -   "-DCMAKE_TOOLCHAIN_FILE:STRING=..\\ToolChain\\toolchain-iar-ARM.cmake" "-DROOT_DIR:PATH=..\IAR\8.42\arm" -G Ninja "mytestproject" && cmake --build . -j 12

Issue with unity cmakefile which I am using Unity/CMakeLists.txt at master · ThrowTheSwitch/Unity · GitHub

I can’t really help you much further, I don’t use the IAR compiler myself, so I don’t know what might be missing or incorrect for you in the above. I will note the following though:

  • No need to escape the spaces in ROOT_DIR because you’ve quoted the whole path.
  • Setting CMAKE_BUILD_TYPE to Target looks wrong. There is no such build type by default. If your project doesn’t define a custom build type by that name, then it is almost certainly not doing whatever you were expecting it to do.

I doubt either of the above two things is related to your problem, but worth mentioning anyway.

Dear Craig,
Thank you for the support.

CMake command is correct as same command is used for successful build with CMake Version 3.19.