If I do:
set_property(TARGET tgt PROPERTY C_STANDARD 99)
in a CMakeLists.txt
and the C compiler is gcc, I get a -std=gnu99
flag rather than -std=c99
. Why? And how do I enforce a -std=c99
?
If I do:
set_property(TARGET tgt PROPERTY C_STANDARD 99)
in a CMakeLists.txt
and the C compiler is gcc, I get a -std=gnu99
flag rather than -std=c99
. Why? And how do I enforce a -std=c99
?
There is C_EXTENSIONS target property, which specifies whether compiler-specific extensions are requested:
This property specifies whether compiler specific extensions should be used. For some compilers, this results in adding a flag such as
-std=gnu11
instead of -std=c11
to the compile line. This property isON
by default. The basic C standard level is controlled by theC_STANDARD
target property.
You may set this property to OFF
for get "pure" C standard.