mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-07 06:34:34 +02:00
cbor: add a workaround for -ffreestanding being passed to clang
Toolchain CMake files for clang currently pass -ffreestanding option to prevent clang from picking the wrong copy of stdint.h. This is a temporary hack until we fix clang distributions to not include the GCC version of stdint.h. This hack, however, results in setting __STDC_HOSTED__=0, which is being checked by cbor header files, making some required functions unavailable as a result. Undefine __STDC_HOSTED__ as a workaround. This flag is only passed when compiling cbor itself.
This commit is contained in:
@@ -13,3 +13,8 @@ idf_component_register(SRCS "tinycbor/src/cborencoder_close_container_checked.c"
|
|||||||
|
|
||||||
# for open_memstream.c
|
# for open_memstream.c
|
||||||
set_source_files_properties(tinycbor/src/open_memstream.c PROPERTIES COMPILE_DEFINITIONS "__linux__")
|
set_source_files_properties(tinycbor/src/open_memstream.c PROPERTIES COMPILE_DEFINITIONS "__linux__")
|
||||||
|
|
||||||
|
# workaround for the fact that we are passing -ffreestanding to Clang
|
||||||
|
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
target_compile_options(${COMPONENT_LIB} PRIVATE "-U __STDC_HOSTED__")
|
||||||
|
endif()
|
||||||
|
Reference in New Issue
Block a user