]> begriffs open source - freertos/blob - examples/coverity/CMakeLists.txt
Update History.txt for V11.0.1 (#932)
[freertos] / examples / coverity / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.15)
2
3 project(coverity)
4
5 set(FREERTOS_KERNEL_PATH "../../")
6 FILE(GLOB FREERTOS_KERNEL_SOURCE ${FREERTOS_KERNEL_PATH}*.c)
7
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
13 # boolean.
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})
17
18 # Add the freertos_config for FreeRTOS-Kernel.
19 add_library(freertos_config INTERFACE)
20
21 target_include_directories(freertos_config
22                            INTERFACE
23                            ./)
24
25 # Select the heap. Values between 1-5 will pick a heap.
26 set(FREERTOS_HEAP "3" CACHE STRING "" FORCE)
27
28 # Select the FreeRTOS port.
29 set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
30
31 # Add the FreeRTOS-Kernel subdirectory.
32 add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
33
34 add_executable(${PROJECT_NAME}
35                ../cmake_example/main.c)
36
37 add_dependencies(${PROJECT_NAME} fix_source)
38
39 target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)