Skip to content

Commit 7f49ec2

Browse files
committed
cmake: Leverage FreeRTOS's CMake Support
FreeRTOS-Kernel added CMake support in cdd406a62f31f. This commit utilizes the CMake support for the demo app. Note that CMAKE_CURRENT_SOURCE_DIR is specified for freertos_config as SYSTEM because I want to ensure that all source and header files find FreeRTOSConfig.h. It still targets the POSIX port. If you intend to build it for another PORT, you will need a toolchain file for your target (and probably a libc to go along with it). Ref: - FreeRTOS/FreeRTOS-Kernel#421 - https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html Signed-off-by: Yasushi SHOJI <[email protected]>
1 parent 297e733 commit 7f49ec2

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

CMakeLists.txt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
cmake_minimum_required(VERSION 3.20)
22
project(libcsp-freertos)
33

4+
if(NOT DEFINED FREERTOS_PORT)
5+
message(STATUS "Auto selecting GCC_POSIX for FREERTOS_PORT")
6+
set(FREERTOS_PORT GCC_POSIX)
7+
endif()
8+
49
add_executable(demo)
510
target_sources(demo PRIVATE
611
main.c
712
hooks.c
8-
freertos/list.c
9-
freertos/queue.c
10-
freertos/tasks.c
11-
freertos/timers.c
12-
freertos/portable/ThirdParty/GCC/Posix/port.c
13-
freertos/portable/ThirdParty/GCC/Posix/utils/wait_for_event.c)
14-
target_include_directories(demo PRIVATE
15-
.
16-
freertos/include
17-
freertos/portable/ThirdParty/GCC/Posix)
18-
target_link_libraries(demo PRIVATE csp)
13+
)
14+
15+
add_library(freertos_config INTERFACE)
16+
target_include_directories(freertos_config SYSTEM
17+
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
1918

19+
add_subdirectory(freertos)
2020
add_subdirectory(subprojects/libcsp)
21+
22+
target_link_libraries(demo PRIVATE
23+
freertos_kernel
24+
freertos_config
25+
csp
26+
)

0 commit comments

Comments
 (0)