Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22040

Cmake target_compile_options with PRIVATE sets compile options for linked libraries as well

$
0
0

Im using target_compile_options to set compiler options for the executable file:

target_compile_options( main_full PRIVATE        ### Gnu/Clang C Options        $<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>        $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>        $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wall>        $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Wextra>        $<$<COMPILE_LANG_AND_ID:C,Clang,GNU>:-Werror>        $<$<COMPILE_LANG_AND_ID:C,Clang>:-Weverything>        )

This causes the compiler options to be set to the other libraries that are linked to the executable (-Werror).

This is how the executable is linked:

target_link_libraries(        main_full        pico_stdlib        FreeRTOS-Kernel        FreeRTOS-Kernel-Heap4        pico_cyw43_arch_none)

If I remove the compiler option (-Werror) that causes the issue from the target_compile_options the project builds fine.

Am I missing something? Is there some other settings that can cause this?


Viewing all articles
Browse latest Browse all 22040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>