So I recently decided to make the switch to using c89 only for my code from now on. I use cmake and i'm not sure how to tell cmake to use c89.
Per a information on a website it says "(accepted values are 98, 99 and 11)", which is really strange because 89 isn't there.
set (CMAKE_C_STANDARD 89)
This code gives me an error.
Whats really strange is that Ive searched everywhere on the web and couldn't find anyone asking about this.
Does anyone know how to use/(restrict) to using only c89 in cmake.
the cmake document says to use
Supported values are:
90
C89/C90
This code works
set (CMAKE_C_STANDARD 90)
However I want the compiler to use just C89 not C90.
CodePudding user response:
Use set(CMAKE_C_STANDARD 90)
to use C89.
C89 is the same as C90, also called ANSI C.
Note: prefer to use set_target_properties(your_target C_STANDARD 90)
explicitly on your target, so it doesn't affect other targets.