I am trying to make the transtition from MBED Studio to VSCode.
I have succesfully compiled and debugged the Blinky example.
I now want to create a large project with many subdirectories.
When I create a new library, and include it’s header in the main.cpp, and try building using MBED CLI2 I get:
myLibrary.hpp: No such file or directory.
Perhaps I have misunderstood the functionality of MBED CLI2, but I thought that it could behave like MBED Studio and could build a project, afterwhich convert it to a CMAKE-build.
So the question is, do I need cmake?
Thanks in advance,
for short: yes.
CLI2 is cmake based, and it has not the automatic scanning feature. This was useful, but when Mbed grown so much, the scan and compile times have grown also very much. And adding libraries was fiddling with excluding unwanted files.
With cmake it is reverse, you have too add the sources to a target file by file. You can add files that belong only to this project in a src dir like this:
or libraries that have an own CMakeLists.txt.
Thank you very much for your reply. Looks like I will have to embrace CMake.
Would you mind posting a link to an example project that uses CMake to wrap my head around it?
Unfortunately, the CLI2 is still stated as work in progress, but currently there is no progress.
There is parallel project:
This has a much better integration into VSCode by using the cmake-tools. The setup is not difficult, there is a good description in the mbed-ce Wiki.
A good starting point is the hello world project in the same repository.
Ah okay, hopefully CLI 2 is stable despite no progress!
I am trying to link mbed-os to myLib Folder’s CMakeLists.txt.
Currently I have:
However I am receiving the error:
add_subdirectory given source
“…/C:/Dev/MBED-Vscode/FanController-MBED/mbed-os” which is not an existing
Any ideas what I am doing wrong?
It looks like the APP_TARGET path is wrong. No valid path can start with
use this as an example:
APP_TARGET is just the app name, not a full path.