Skip to content

Commit

Permalink
Work on making it so this cmake file can be included from anywhere, n…
Browse files Browse the repository at this point in the history
…ot just if it's used from this directoy
  • Loading branch information
Skptak committed Sep 21, 2023
1 parent 8c9b032 commit 92278d1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
31 changes: 16 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -273,25 +273,26 @@ target_compile_options(freertos_kernel PRIVATE


########################################################################
add_subdirectory(include)
add_subdirectory(portable)
include(${CMAKE_CURRENT_LIST_DIR}/include/CMakeLists.txt)
include(${CMAKE_CURRENT_LIST_DIR}/portable/CMakeLists.txt)

target_sources(freertos_kernel PRIVATE
croutine.c
event_groups.c
list.c
queue.c
stream_buffer.c
tasks.c
timers.c

# Check if user requested to not include a heap implementation
if(NOT DEFINED FREERTOS_DO_NOT_INCLUDE_HEAP)
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
endif()
${CMAKE_CURRENT_LIST_DIR}/croutine.c
${CMAKE_CURRENT_LIST_DIR}/event_groups.c
${CMAKE_CURRENT_LIST_DIR}/list.c
${CMAKE_CURRENT_LIST_DIR}/queue.c
${CMAKE_CURRENT_LIST_DIR}/stream_buffer.c
${CMAKE_CURRENT_LIST_DIR}/tasks.c
${CMAKE_CURRENT_LIST_DIR}/timers.c
)

# Check if user requested to not include a heap implementation
if(NOT DEFINED FREERTOS_DO_NOT_INCLUDE_HEAP)
target_sources(freertos_kernel PRIVATE
# If FREERTOS_HEAP is digit between 1 .. 5 - it is heap number, otherwise - it is path to custom heap source file
$<IF:$<BOOL:$<FILTER:${FREERTOS_HEAP},EXCLUDE,^[1-5]$>>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c>
)
endif()

target_link_libraries(freertos_kernel
PUBLIC
Expand Down
2 changes: 1 addition & 1 deletion include/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ add_library(freertos_kernel_include INTERFACE)

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

0 comments on commit 92278d1

Please sign in to comment.