Skip to content

cmake can not active C11 with Clang Gnu Gommand Like with msvc as target

Hi, i installed msvc (visual studio 2019 16.8.4 ) and llvm-clang (12 snapshot)in win10 (20h2) so why cmake (3.19.4 )can not ACTIVE C11 in clang with msvc as target(x86_64-pc-windows-msvc) with with gnu command like(clang) not (clang-cl) it generate a binary but not with c11 std! with -G Ninja or NMake Makefiles both failed to set c11 binary. but clang gnu command like with msvc as target without cmake can build binary with -std=c11!

clang 0.c -target x86_64-pc-windows-msvc -std=c11

in clang gnu command like not clang-cl. CMakeLists.txt:

project(0 C)
set(CMAKE_C_STANDARD 11)
add_executable(0 0.c)

clang with msvc and gnu command like clang set value for__STDC_VERSION__ to 201112 when i use

clang 0.c -target x86_64-pc-windows-msvc -std=c11

but cmake can not enable this.

Edited by think2021
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information