Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular dependency in CMake project #700

Merged
merged 5 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ elseif((FREERTOS_PORT STREQUAL "A_CUSTOM_PORT") AND (NOT TARGET freertos_kernel_
" .)\n"
" target_link_libraries(freertos_kernel_port\n"
" PRIVATE\n"
" freertos_kernel)")
" freertos_kernel_include)")
endif()

########################################################################
Expand Down Expand Up @@ -264,6 +264,7 @@ add_compile_options(


########################################################################
add_subdirectory(include)
add_subdirectory(portable)

add_library(freertos_kernel STATIC
Expand All @@ -279,17 +280,10 @@ add_library(freertos_kernel STATIC
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
)

target_include_directories(freertos_kernel
PUBLIC
include
# Note: DEPRECATED but still supported, may be removed in a future release.
$<$<NOT:$<TARGET_EXISTS:freertos_config>>:${FREERTOS_CONFIG_FILE_DIRECTORY}>
)

target_link_libraries(freertos_kernel
PUBLIC
$<$<TARGET_EXISTS:freertos_config>:freertos_config>
freertos_kernel_port
freertos_kernel_include
)

########################################################################
15 changes: 15 additions & 0 deletions include/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# FreeRTOS internal cmake file. Do not use it in user top-level project

add_library(freertos_kernel_include INTERFACE)

target_include_directories(freertos_kernel_include
INTERFACE
.
# Note: DEPRECATED but still supported, may be removed in a future release.
$<$<NOT:$<TARGET_EXISTS:freertos_config>>:${FREERTOS_CONFIG_FILE_DIRECTORY}>
)

target_link_libraries(freertos_kernel_include
INTERFACE
$<$<TARGET_EXISTS:freertos_config>:freertos_config>
)
2 changes: 1 addition & 1 deletion portable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ target_link_libraries(freertos_kernel_port
$<$<STREQUAL:${FREERTOS_PORT},GCC_RP2040>:pico_base_headers>
$<$<STREQUAL:${FREERTOS_PORT},GCC_XTENSA_ESP32>:idf::esp32>
PRIVATE
freertos_kernel
freertos_kernel_include
$<$<STREQUAL:${FREERTOS_PORT},GCC_POSIX>:Threads::Threads>
"$<$<STREQUAL:${FREERTOS_PORT},GCC_RP2040>:hardware_clocks;hardware_exception>"
$<$<STREQUAL:${FREERTOS_PORT},MSVC_MINGW>:winmm> # Windows library which implements timers
Expand Down