MENU

Fun & Interesting

CMake - the essential package

Code for yourself 14,981 2 years ago
Video Not Working? Fix It Now

*Help me keep doing these videos!* This works relies on *your* support! You can show it in one of these ways: 📚 Start a FREE Audible trial: https://www.audibletrial.com/CodeForYourself 🛍️ Buy gear I use to make this video: https://github.com/cpp-for-yourself/sponsor/blob/main/amazon.md 💶 Directly become a sponsor on GitHub: https://github.com/sponsors/niosus 📺 Watch my videos *to the end* and leave comments ⁉️ Find *your* way to support this work here: https://github.com/cpp-for-yourself/sponsor/tree/main In this video we talk about *CMake*, one of the most used build generation tools. It allows us to have a readable but comprehensive script for our build. Chances are if you look for a random open source project it will support CMake out of the box. We don't cover _everything_ there is about CMake, but pretty much cover most of the important things. 🎓 Slides: https://github.com/cpp-for-yourself/supplementary-materials/blob/main/lectures/cmake.md *Related materials* - An amazing CMake tutorial from which lots of inspiration was drawn: https://cliutils.gitlab.io/modern-cmake/ - Official CMake website: https://cmake.org *Support Ukraine* 🇺🇦 Ukraine is fighting a war against unprovoked russian aggression. Please donate to one of the funds to support them: https://www.defendukraine.org/donate Stock footage of the dominos clip provided by Videvo, downloaded from videvo.net *Contents* 00:00 - Intro 00:41 - What is CMake 01:39 - Intuition behind CMake 02:40 - CMake is just a scripting language 03:32 - Minimal CMake project 04:51 - Explaining what CMake actually does 06:15 - Printing messages in CMake 06:54 - Building a CMake project with cmake command 08:57 - Looking at the cache manually 09:44 - Using ccmake to build the project 11:33 - Using FORCE with variables 12:16 - Using INTERNAL keyword with variables 12:42 - Setting local variables 13:12 - Adding a library with CMake 14:52 - Add executables with CMake 15:07 - Setting target properties with CMake 16:40 - Dependencies between targets 17:52 - What target properties can we set 18:35 - When to use which visibility 19:21 - Example CMake project 27:09 - Outro

Comment