# Target "unity" requires the language dialect "C11"

**URL:** https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333
**Category:** Usage
**Created:** [August 25, 2022, 4:40am UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333 "2022-08-25T04:40:47Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![lkahir](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@lkahir](https://discourse.cmake.org/u/lkahir)
#### Post date: [August 25, 2022, 4:40am UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333/1 "2022-08-25T04:40:47Z")

</div>

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

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [August 25, 2022, 11:16pm UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333/2 "2022-08-25T23:16:30Z")

</div>

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](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/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.

---

<div class="post-metadata">

### Author: ![lkahir](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@lkahir](https://discourse.cmake.org/u/lkahir)
#### Post date: [August 26, 2022, 5:30am UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333/3 "2022-08-26T05:30:50Z")

</div>

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:**

```cmake
set(CMAKE_SYSTEM_NAME Generic) 

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

set(BINUTILS_PATH "${ROOT_DIR}/bin/")
set(TOOLCHAIN_NAME IAR-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:**

```auto
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](https://github.com/ThrowTheSwitch/Unity/blob/master/CMakeLists.txt)

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [August 26, 2022, 10:10am UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333/4 "2022-08-26T10:10:29Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![lkahir](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@lkahir](https://discourse.cmake.org/u/lkahir)
#### Post date: [August 26, 2022, 12:35pm UTC](https://discourse.cmake.org/t/target-unity-requires-the-language-dialect-c11/6333/5 "2022-08-26T12:35:20Z")

</div>

Dear Craig,  
Thank you for the support.

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