Fixed compile options polluting project (#694)

* Fixed compile options polluting project

Moved add_library higher

* Apply suggestions from code review

Co-authored-by: Paul Bartell <paul.bartell@gmail.com>

* fixed cmakelists keeping in mind the suggestions

---------

Co-authored-by: Paul Bartell <paul.bartell@gmail.com>
Co-authored-by: Gaurav-Aggarwal-AWS <33462878+aggarg@users.noreply.github.com>
Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com>
This commit is contained in:
Mr. Jake 2023-07-16 00:16:31 +02:00 committed by GitHub
parent b60ab2fa14
commit 6f6f656aa7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -228,6 +228,9 @@ elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_
" freertos_kernel_include)") " freertos_kernel_include)")
endif() endif()
add_library(freertos_kernel STATIC)
######################################################################## ########################################################################
# Overall Compile Options # Overall Compile Options
# Note the compile option strategy is to error on everything and then # Note the compile option strategy is to error on everything and then
@ -248,7 +251,7 @@ endif()
# MSVC | MSVC # Note only for MinGW? # MSVC | MSVC # Note only for MinGW?
# Renesas | ?TBD? # Renesas | ?TBD?
add_compile_options( target_compile_options(freertos_kernel PRIVATE
### Gnu/Clang C Options ### Gnu/Clang C Options
$<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always> $<$<COMPILE_LANG_AND_ID:C,GNU>:-fdiagnostics-color=always>
$<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics> $<$<COMPILE_LANG_AND_ID:C,Clang>:-fcolor-diagnostics>
@ -267,7 +270,7 @@ add_compile_options(
add_subdirectory(include) add_subdirectory(include)
add_subdirectory(portable) add_subdirectory(portable)
add_library(freertos_kernel STATIC target_sources(freertos_kernel PRIVATE
croutine.c croutine.c
event_groups.c event_groups.c
list.c list.c
@ -280,6 +283,7 @@ add_library(freertos_kernel STATIC
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c> $<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
) )
target_link_libraries(freertos_kernel target_link_libraries(freertos_kernel
PUBLIC PUBLIC
freertos_kernel_port freertos_kernel_port