I ran PlatformIO update for my ESP8266 project, which updated Espressif8266 to v3.0.0 (and maybe other stuff that I didn’t notice at the time). Now, when I do a PIO Init, I get the following errors for all my targets:
CMake Error at CMakeLists.txt:33 (add_executable):
C_STANDARD is set to invalid value '17'
This references the following line at the bottom of the CMakeLists.txt file:
add_executable(Z_DUMMY_TARGET ${SRC_LIST})
I’ve never really understood what the Z_DUMMY_TARGET is.
I tried re-creating my project from scratch in a new directory and invalidating CLion caches, but I still get the same error.
Is anyone else having this problem, or can someone offer some advice on how I can resolve it?
Many thanks!
Regarding simliar issues of CMake not recognizing C++17 e.g. here indicates that CMake probably has to be updated to recognize it.
Are you running the latest version of CLion? When you go into File → Settings → Buid,Execution,Deployment → Toolchains, what does it show for “CMake Version”?
I also downloaded CMake 3.21.x and it works now. I also had to modify a setting for it to work properly.
open File | Settings | Languages & Frameworks | C/C++ | Clangd* and append ,–target=riscv32 to the end of clangd diagnostics options.
when using ESP8266 the standard is automatically set to C17 and the error is still present, no matter if I update CMAKE.
can someone from platformio fix this please?
Arduino-ESP8266 using C17 with CLion by default not having a CMake version that supports this C language version is not something that can be fixed by PlatformIO, but rather CLion. Can you open a bug report in https://youtrack.jetbrains.com/issues/CPP?