Compile FreeRTOS demo with CMake


I’m trying to adapt the Posix GCC Demo in order to replace Make by CMake. I need to do this because I have to include FreeRTOS in a existing project based on CMake. I made a custom project inspired by the demo one with a working Makefile. If I compile this project, it runs correctly.

I try now to write my own CMakeLists.txt based on the initial Makefile. However, when building I have inclusions errors. Compiler can not find specific files.

I commented each line of the CMakeLists.txt with it’s equivalent in the Makefile, but it seems that I’m missing something. Do anyone find something strange in this file ?

You can find more details in the repository README. Btw the full repo can be cloned and tested.

Thank you !


Looking at the errors, it seems you are compiling ARMv8M port files which you are not supposed to. Probably this line means that you are compile everything in the FreeRTOS source folder including everything in the portable folder:

This is not correct. You want to compile the following files:
Generic Code

  • event_groups.c
  • list.c
  • queue.c
  • stream_buffer.c
  • tasks.c
  • timers.c

Port Specific Code

  • Files in portable/ThirdParty/GCC/Posix.


  • One of portable/MemMang.

This page provides more details on how to create a new FreeRTOS project:


Got it, GLOB_RECURSE was a mistake. I have to use GLOB instead. So obvious.

Thanks !