diff --git a/CMakeLists.txt b/CMakeLists.txt index f9eeb2a1ee7..c092da6c381 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 - $>,${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 + $>,${FREERTOS_HEAP},portable/MemMang/heap_${FREERTOS_HEAP}.c> + ) +endif() target_link_libraries(freertos_kernel PUBLIC diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index 46a1c3e7f5f..7b28df06655 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -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. $<$>:${FREERTOS_CONFIG_FILE_DIRECTORY}> )