Hello everyone,
I’m using the FreeRTOS-Kernel in my project and managing it with FetchContent
in CMake. Everything is working fine, but I’d like to configure the way I include FreeRTOS headers for clarity and to avoid potential naming conflicts with other libraries.
Currently, I include headers like this:
#include <timers.h>
#include <task.h>
However, I’d like to make it more explicit that these headers are part of FreeRTOS by including them with a prefix, like this:
e.g.
#include <freertos-kernel-src/include/timers.h>
#include <freertos-kernel-src/include/task.h>
Reasons for Doing This
- Prevent Naming Conflicts: To avoid clashes with similarly named headers from other libraries.
- Improve Readability: To make it clear in the code that these are FreeRTOS headers.
My Setup
- I use the FreeRTOS
CMakeLists.txt
files directly (viaFetchContent
) without modifying them. - My project structure is standard, with FreeRTOS headers located under
freertos-kernel-src/include
.
My Question
How can I configure my project to achieve this header inclusion format without modifying the FreeRTOS repository or its CMake files? Ideally, I want this to be done in my own project’s CMakeLists.txt
.
Has anyone faced a similar issue or found a clean solution for this?
Thanks in advance for your help!