Forcing C standard in CMake

61 views Asked by At

I am trying to use C11 instead of C99 in my CMake project.

I tried setting the standard like this:

set(CMAKE_C_STANDARD 11)

And like this as well:

set_property(TARGET vkvoxel PROPERTY C_STANDARD 11)

But none of them didn't work. So I tried forcing them:

set(CMAKE_C_STANDARD_REQUIRED TRUE)

And like this:

set_property(TARGET vkvoxel PROPERTY C_STANDARD_REQUIRED ON)

But I still would get:

C:\Users\REDACTED\Documents\vkvoxel\source\voxel.c:13:22: error: call to undeclared library function 'aligned_alloc' with type 'void *(unsigned long long, unsigned long long)'; ISO C99 and later do
      not support implicit function declarations [-Wimplicit-function-declaration]
   13 |         chunkbuffer->data = aligned_alloc(16, sizeof(chunk_t) * size);

I did in fact have stdlib.h included, but it indicates that I'm still using C99, even though I forced C11 in the CMake configuration... Anyone know why this happens?

0

There are 0 answers