]> begriffs open source - freertos/blob - examples/coverity/CMakeLists.txt
FreeRTOS MPU: Remove MPU region number check (#1261)
[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 FILE(GLOB FREERTOS_PORT_CODE ${FREERTOS_KERNEL_PATH}/portable/template/*.c)
8
9 # Coverity incorrectly infers the type of pdTRUE and pdFALSE as boolean because
10 # of their names. This generates multiple false positive warnings about type
11 # mismatch. Replace pdTRUE with pdPASS and pdFALSE with pdFAIL to avoid these
12 # false positive warnings. This workaround will not be needed after Coverity
13 # fixes the issue of incorrectly inferring the type of pdTRUE and pdFALSE as
14 # boolean.
15 add_custom_target(fix_source ALL
16                   COMMAND sed -i -b -e 's/pdFALSE/pdFAIL/g' -e 's/pdTRUE/pdPASS/g' ${FREERTOS_KERNEL_SOURCE} ${FREERTOS_PORT_CODE}
17                   DEPENDS ${FREERTOS_KERNEL_SOURCE} ${FREERTOS_PORT_CODE})
18
19 # Add the freertos_config for FreeRTOS-Kernel.
20 add_library(freertos_config INTERFACE)
21
22 target_include_directories(freertos_config
23                            INTERFACE
24                            ./)
25
26 if (DEFINED FREERTOS_SMP_EXAMPLE AND FREERTOS_SMP_EXAMPLE STREQUAL "1")
27     message(STATUS "Build FreeRTOS SMP example")
28     # Adding the following configurations to build SMP template port
29     add_compile_options( -DconfigNUMBER_OF_CORES=2 -DconfigUSE_PASSIVE_IDLE_HOOK=0 )
30 endif()
31
32 # Select the heap. Values between 1-5 will pick a heap.
33 set(FREERTOS_HEAP "3" CACHE STRING "" FORCE)
34
35 # Select the FreeRTOS port.
36 set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE)
37
38 # Add the FreeRTOS-Kernel subdirectory.
39 add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel)
40
41 add_executable(${PROJECT_NAME}
42                ../cmake_example/main.c)
43
44 add_dependencies(${PROJECT_NAME} fix_source)
45
46 target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config)