OVMS3-idf/components/driver/CMakeLists.txt
Ivan Grokhotkov 7027d2dfe8 spi_master: compile as C11 due to use of stdatomic.h
stdatomic.h is available both in newlib and GCC include directories.
Normally (if you invoke the compiler without any flags) GCC include
directories are first on the list, so GCC’s stdatomic.h is used. In
IDF, we used to pass newlib include path as an extra include
directory, so newlib’s stdint.h got included instead.

Newlib 2.2.0 stdatomic implementation is compatible with -std=gnu99
but incompatible with -std=gnu11. And GCC doesn’t support atomic_load
with -std=gnu99 (it’s a C11 feature). So when we used atomic_load
with -std=gnu99, it worked due to newlib’s header.

Since we are no longer going to be including newlib headers into IDF,
GCC stdatomic will be used instead. Hence, add -std=gnu11 for source
files which use atomic features.
2019-04-10 13:48:57 +08:00

34 lines
988 B
CMake

set(COMPONENT_SRCS "can.c"
"gpio.c"
"i2c.c"
"i2s.c"
"ledc.c"
"mcpwm.c"
"pcnt.c"
"periph_ctrl.c"
"rmt.c"
"rtc_module.c"
"sdio_slave.c"
"sdmmc_host.c"
"sdmmc_transaction.c"
"sdspi_crc.c"
"sdspi_host.c"
"sdspi_transaction.c"
"sigmadelta.c"
"spi_common.c"
"spi_master.c"
"spi_slave.c"
"timer.c"
"uart.c")
set(COMPONENT_ADD_INCLUDEDIRS "include")
set(COMPONENT_PRIV_INCLUDEDIRS "include/driver")
set(COMPONENT_REQUIRES esp_ringbuf)
register_component()
if(GCC_NOT_5_2_0)
# uses C11 atomic feature
set_source_files_properties(spi_master.c PROPERTIES COMPILE_FLAGS -std=gnu11)
endif()