From fd1c213be4dcf7260600288519c0580362b5b2f9 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 16 Nov 2021 00:06:57 +0100 Subject: [PATCH] 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. --- components/esp_rom/CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/esp_rom/CMakeLists.txt b/components/esp_rom/CMakeLists.txt index 251f60edfb..ad48f71bd1 100644 --- a/components/esp_rom/CMakeLists.txt +++ b/components/esp_rom/CMakeLists.txt @@ -48,8 +48,11 @@ endfunction() if(target STREQUAL "linux") # 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 - target_compile_options(${COMPONENT_LIB} PUBLIC -Wimplicit-fallthrough=0 -Wno-shift-count-overflow) + if(CMAKE_C_COMPILER_ID STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} GREATER "7.0.0") + 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() else() target_linker_script(${COMPONENT_LIB} INTERFACE "${target}/${ld_folder}/${target}.rom.ld")