CMake For Beginners? Create a C++ / CMake Project in 2 Minutes

preview_player
Показать описание
If you're a beginner, writing the CMake for your C++ projects can be very scary indeed. Do we really have to spend sometimes hours just to get a "hello world" project to compile? This is where "cmake-init" comes in!

cmake-init will generate a skeleton CMake & C++ project that is ready to be integrated & compiled by the most popular IDEs out there. All you need to do is run "cmake-init" and open the project with your favourite IDE, as it contains all the CMake presets needed.

Feel free to put your questions and feedback in the comments below! And please subscribe for more quality CMake videos.

Tools mentioned or used in this video:
- WSL with Ubuntu
- Windows Terminal
- CMake
- Conan for C++ package management
- Vscode

Sounds used:

Licensed under Creative Commons: By Attribution 3.0 License
Рекомендации по теме
Комментарии
Автор

You should check out cmkr, its a toml representation of CMake essentially, it also does support "cmkr init" which generates a barebone project. Been using it for some time now and its a lot easier not having to deal with this odd CMake language.

ZehMatt
Автор

the more you setup and use this tools the more you thanks IDE done dirty jobs for you!

qlrvfjd
Автор

Another great video, Mat!
I tried it on Windows (Native) and it worked.
I had clang-tidy, so I enabled it, and I chose vcpkg haha;

Also, I chose 20 as the C++ standard during the CL setup, but then changed it to 23 in the CMakeLists file, for I am using the Microsoft Compiler and wanted to try some new stuff.
Also, I disabled the installation of fmt::format, and, since I'm using MSVC with the latest std, I included format instead (#include <format>), and in the .cpp, used std:: instead of fmt::).
[ GCC doesn't support std::format yet :/ ]

theintjengineer