esp_rom: support building for Linux target with Clang

This fixes passing -Wimplicit-fallthrough=0 flag to Clang, which it
doesn't recognize, and is not necessary for this file.
Also the flag is changed from PUBLIC to PRIVATE since it is necessary
when compiling this component only.
This commit is contained in:
Ivan Grokhotkov 2021-11-16 00:06:57 +01:00
parent e7e059cc0a
commit fd1c213be4

View File

@ -48,8 +48,11 @@ endfunction()
if(target STREQUAL "linux") if(target STREQUAL "linux")
# We need to disable some warnings due to the ROM code's printf implementation # We need to disable some warnings due to the ROM code's printf implementation
if(${CMAKE_CXX_COMPILER_VERSION} GREATER "7.0.0") # TODO: clang compatibility if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} GREATER "7.0.0")
target_compile_options(${COMPONENT_LIB} PUBLIC -Wimplicit-fallthrough=0 -Wno-shift-count-overflow) target_compile_options(${COMPONENT_LIB} PRIVATE -Wimplicit-fallthrough=0 -Wno-shift-count-overflow)
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang") # Clang or AppleClang
target_compile_options(${COMPONENT_LIB} PRIVATE -Wno-integer-overflow -Wno-shift-count-overflow)
endif() endif()
else() else()
target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/${ld_folder}/${target}.rom.ld") target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/${ld_folder}/${target}.rom.ld")