fwiw, we created the Mbed CE project as a way to build and use Mbed without relying on Mbed Studio, partly due to issues like this. It allows you to build Mbed OS using only CMake and your IDE of choice (CLion/VS Code), allows more complex project structures such as having multiple executables/libraries in a single project, and is generally adaptable to more complex project setups that are seen on real projects. While I can’t guarantee it will solve every pain point with Mbed, it should at least deal with most of the issues you faced here. If you want to give it a shot, check out the hello world project here.