2020-12-18 10:20 AM
Since it took a tremendous amount of effort in getting CMake working within STM32CubeIDE, I'd thought I'd share a method of getting it done. I've only tested this working in Windows. Many an hour could have been saved if ST, in their infinite wisdom, did not disable the Toolchain tree entry in the project C/C++ properties!
Disclaimer: I'm not an experienced Eclipse user, so there is a very good chance that the steps below are not the correct way of doing things, and in future, ST might lock-down or hide more UI rendering these steps useless - you have been warned!
There are a huge number of steps required, so this is not for the fainthearted!
Prerequisite: You must have an existing CMake GNU Arm project up and running, if not, find out how set one up, or use CLion to create a CMake project from an existing STM32CubeMX .ioc.
For the steps, I'm using the following folder layout (adjust to fit your preferences):
Source (source code, folders, etc)
build
.. this where I set CMake to run the builds..
cmake
gnu-arm-stm32.cmake
...
CMakeLists.txt
Tools
STM32CubeIDE
MyProject (the skeleton project created in the below steps)
.cproject
.project
svd
STM32F446.svd
Matthew.
Solved! Go to Solution.
2022-12-19 02:48 AM
Hi @xlrl ,
It is recommended to describe the issue you are currently facing in a new post.
Any way I add our STM32CubeIDE expert in the loop in order to update us on the status of the CMake integration with latest IDE release @Semer CHERNI .
-Amel
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-12-19 02:55 AM
Okay, understand. Thanks! I created a new question.
-Alex
2023-09-11 11:20 AM
Seems like CMake is now integrated with CubeIDE, making this thread irrelevant ?
2023-11-19 02:00 AM
I follow this steps but I cannot find CMAKE_EXPORT_COMPILE_COMMANDS Compiler Built-ins in Provider.
Could anyone help me? thanks
2023-11-20 05:17 AM
have you seen this page yet? I take a very different approach to cmake with STM32
https://community.st.com/t5/stm32cubeide-mcus/my-solution-for-building-project-for-stm32f7-evaluation-board/m-p/594258
2024-10-21 11:54 AM
This solution did not work. I just upgraded to STMCubeIDE 1.16.1. It is the
21st October 2024.
I got the following error. Also, a few things could not be completed as shown.
19:22:51 Buildscript generation: DevHeadsFreeRTOS::Debug in D:\Documents\STM32CubeIDE\workspace\DevHeadsFreeRTOS\build\cmake-cubeide-Debug
cmake -DCMAKE_BUILD_TYPE:STRING=Debug -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON "D:\\Documents\\STM32CubeIDE\\workspace\\DevHeadsFreeRTOS"
CMake Warning:
Ignoring extra path from command line:
"D:\Documents\STM32CubeIDE\workspace\DevHeadsFreeRTOS"
CMake Error: The source directory "D:/Documents/STM32CubeIDE/workspace/DevHeadsFreeRTOS" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Here the instructions led to the workspace directory being used for the source directory.
The sources are there also. But the CMakeLists.txt file is in the sources directory
somewhere else, which was specified.
- D:\Documents\Embedded Systems\IoT\DevHeadsDiscord\FreeRTOS\FreeRTOS_samples-main
By going through this again I could specify the actual sources directory again but
the error was the same.
A few other details are not as they are explained in the IDE:
Requires: STM32CubeIDE 1.5.0+, CMake and Ninja-build installed
- Ninja-build gives Cmake4eclipse in Eclipse Market place. - is installed
Switch indexer to use CMake providers
--> I only have the entry - CMake Compilation DB - which I selected
Add root source code folder containing CMakeLists.txt
The last step was done -
- D:\Documents\Embedded Systems\IoT\DevHeadsDiscord\FreeRTOS\FreeRTOS_samples-main
Configure CMake settings
2024-10-22 05:16 AM
CMake Error: The source directory "D:/Documents/STM32CubeIDE/workspace/DevHeadsFreeRTOS" does not appear to contain CMakeLists.txt.
You have to run the cmake command in the folder with the CMakeLists.txt