cmake_minimum_required(VERSION 3.15) project(example) set(FREERTOS_KERNEL_PATH "../../") # Add the freertos_config for FreeRTOS-Kernel add_library(freertos_config INTERFACE) target_include_directories(freertos_config INTERFACE "../template_configuration" ) if (DEFINED FREERTOS_SMP_EXAMPLE AND FREERTOS_SMP_EXAMPLE STREQUAL "1") message(STATUS "Build FreeRTOS SMP example") # Adding the following configurations to build SMP template port add_compile_options( -DconfigNUMBER_OF_CORES=2 -DconfigUSE_PASSIVE_IDLE_HOOK=0 ) endif() # Select the heap port. values between 1-4 will pick a heap. set(FREERTOS_HEAP "4" CACHE STRING "" FORCE) # Select the native compile PORT set(FREERTOS_PORT "TEMPLATE" CACHE STRING "" FORCE) # Adding the FreeRTOS-Kernel subdirectory add_subdirectory(${FREERTOS_KERNEL_PATH} FreeRTOS-Kernel) ######################################################################## # Overall Compile Options # Note the compile option strategy is to error on everything and then # Per library opt-out of things that are warnings/errors. # This ensures that no matter what strategy for compilation you take, the # builds will still occur. # # Only tested with GNU and Clang. # Other options are https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html#variable:CMAKE_%3CLANG%3E_COMPILER_ID # Naming of compilers translation map: # # FreeRTOS | CMake # ------------------- # CCS | ?TBD? # GCC | GNU, Clang, *Clang Others? # IAR | IAR # Keil | ARMCC # MSVC | MSVC # Note only for MinGW? # Renesas | ?TBD? target_compile_options(freertos_kernel PRIVATE ### Gnu/Clang C Options $<$:-fdiagnostics-color=always> $<$:-fcolor-diagnostics> $<$:-Wall> $<$:-Wextra> $<$:-Wpedantic> $<$:-Werror> $<$:-Wconversion> $<$:-Weverything> # Suppressions required to build clean with clang. $<$:-Wno-unused-macros> $<$:-Wno-padded> $<$:-Wno-missing-variable-declarations> $<$:-Wno-covered-switch-default> $<$:-Wno-cast-align> ) add_executable(${PROJECT_NAME} main.c ) target_link_libraries(${PROJECT_NAME} freertos_kernel freertos_config) set_property(TARGET freertos_kernel PROPERTY C_STANDARD 90)