2

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?

einpoklum
  • 118,144
  • 57
  • 340
  • 684

1 Answers1

3

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 is ON by default. The basic C standard level is controlled by the C_STANDARD target property.

You may set this property to OFF for get "pure" C standard.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153