1 cmake_minimum_required(VERSION 3.15)
5 set(FREERTOS_KERNEL_PATH "../../")
6 FILE(GLOB FREERTOS_KERNEL_SOURCE ${FREERTOS_KERNEL_PATH}*.c)
8 # Coverity incorrectly infers the type of pdTRUE and pdFALSE as boolean because
9 # of their names. This generates multiple false positive warnings about type
10 # mismatch. Replace pdTRUE with pdPASS and pdFALSE with pdFAIL to avoid these
11 # false positive warnings. This workaround will not be needed after Coverity
12 # fixes the issue of incorrectly inferring the type of pdTRUE and pdFALSE as
14 add_custom_target(fix_source ALL
15 COMMAND sed -i -b -e 's/pdFALSE/pdFAIL/g' -e 's/pdTRUE/pdPASS/g' ${FREERTOS_KERNEL_SOURCE}
16 DEPENDS ${FREERTOS_KERNEL_SOURCE})
18 # Add the freertos_config for FreeRTOS-Kernel.
19 add_library(freertos_config INTERFACE)
21 target_include_directories(freertos_config
25 # Select the heap. Values between 1-5 will pick a heap.
26 set(FREERTOS_HEAP "3" CACHE STRING "" FORCE)
28 # Select the FreeRTOS port.
29 set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
31 # Add the FreeRTOS-Kernel subdirectory.
32 add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
34 add_executable(${PROJECT_NAME}
35 ../cmake_example/main.c)
37 add_dependencies(${PROJECT_NAME} fix_source)
39 target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)