More Modern CMake

Welcome to HSF CMake tutorial! The aim of this tutorial is to cover the basics of using CMake. This tutorial is based on the online book Modern CMake, with a focus on CMake 3.14+. This is in what is called the “More Modern” era of CMake (roughly defined as 3.12+), and includes the fantastic command line improvements in CMake π (3.14).

This workshop covers the basics of making and building a project, and some details of design.

Designed and first taught at the 2019 USATLAS Computing Bootcamp at LBNL with the support of FIRST-HEP and IRIS-HEP. Also taught at the 2020 USATLAS Computing Bootcamp.

Prereqs

The HSF Training Curriculum

HSF Logo
This training module is part of the Training Curriculum, a series of training modules that serves HEP newcomers the software skills needed as they enter the field, and in parallel, instill best practices for writing software.

Schedule

Setup Download files required for the lesson
00:00 1. Introduction What is the difference between a build system and a build system generator?
00:10 2. Building with CMake How do I build a project?
00:30 3. Your first CMakeLists.txt file How little can I get away with in my CMakeLists?
00:50 4. Working with Targets How do targets work?
01:15 5. Variables explained How do variables work?
01:35 6. Project Structure What should my project look like?
01:55 7. Common Problems and Solutions What could go possibly wrong?
02:00 8. Debugging How do I debug everything?
02:20 9. Finding Packages How do I search for packages?
02:30 10. ROOT How do I use ROOT?
02:50 11. Functions in CMake How do I write my own CMake commands?
03:00 Finish

The actual schedule may vary slightly depending on the topics and exercises chosen by the instructor.