NOAA-OWP / evapotranspiration

Other
3 stars 9 forks source link

require c99 standard compiler to build #11

Closed hellkite500 closed 2 years ago

hellkite500 commented 2 years ago

cmake builds may fail with compilers that default to older C standards. There are several loops in the code with the following structure:

for( int i = 0; i < INPUT_VAR_NAME_COUNT; i++){

}

This is illegal syntax in C standards prior to 99, and would require each of these loops to be re-written as such

int i = 0;
for( i = 0; i < INPUT_VAR_NAME_COUNT; i++){

}

I don't think in 2022 it is unreasonable to simply require a C compiler that supports the C99 standard that allows the first syntax to work as intended. This PR simply forces CMake to pass the --std=C99 to the complier to ensure the build will pass for any compiler that supports a --std flag.

Changes

Testing

  1. Tested the configuration and build using gcc 4.8.5

Checklist

Target Environment support

hellkite500 commented 2 years ago

@madMatchstick it wouldn't hurt...