CMake Training

When:
August 23, 2021 @ 12:00 pm – 4:00 pm
2021-08-23T12:00:00-04:00
2021-08-23T16:00:00-04:00
Cost:
Free
Contact:
Osni Marques

Due to the great interest that this training attracted, we are unable to accommodate additional participants and registration is now closed.

The training class will be virtual and will use computational resources available at NERSC for the exercises. The tentative agenda for the training is given below.  The training is targeted at a deeper understanding of CMake. It seeks to assist ECP developers in learning how to resolve issues outside of their control, in addition to writing a build system generator capable of seamlessly configuring for multiple unique architectures with a variety of compilers.

Tentative Agenda

Session #1: Monday, August 23, 12pm – 4pm ET

— Kitware Background
— CMake Background

  • What it is
  • Why it exists
  • Why you should use it

— Introduction to CMake
— Resources for learning CMake

  • How to install CMake
  • How to run CMake on existing projects
  • CMake workflow
  • Exercise: run cmake-gui, ccmake and cmake

— Commands and Variables

  • CMake basic syntax
  • CMake commands
  • CMake variables
  • Configuring header files
  • Requiring a CMake version
  • Language levels ( c++11/14/17/20 )
  • Exercise: configure a file and C++11 controls
  • Flow control
  • Variable scope
  • Functions/macros
  • CMake cache variables
  • Compiler options
  • Build configurations (debug vs. release)
  • CMake presets

— Libraries

  • Different types of libraries: shared/static/object/module
  • Linking & specifying dependencies
  • Exercise: adding a library
  • Usage requirements / modern CMake
  • Exercise: usage requirements

— Speeding up your Builds

Session #2: Tuesday, August 24, 12pm – 4pm ET

— Install rules
— Testing with CMake

  • CTest features
  • Multi core tests
  • Test resource allocation
  • Exercise: installing and testing

— System Introspection

  • Using find modules
  • Using config modules
  • Writing find modules
  • Understanding find module search order
  • Debugging find modules
  • Include command
  • Exercise: system introspection

— Build Artifact Controls
— Custom Commands

  • Exercise: custom command and generated file

— CMake Scripting
— Using CPack to create installers

  • Exercise: building an installer

— Reporting build/test results to CDash

  • Feature overview
  • Coverage
  • Static analysis
  • Dynamic analysis
  • Exercise: submitting results to a dashboard

Session #3: Wednesday, August 25, 12pm – 4pm ET

— Mixing Library Types
— Symbol Visibility
— Library Visibility

  • Exercise: mixing static and shared

— Generator Expressions

  • Exercise: using generator expressions

— Importing & Exporting Targets

  • Exercise: export configuration

— CMake’s Policy System
— MPI Support
— CUDA Support
— Cross Compilation
— External Project & Fetch Content
— Fortran Support
— Noteworthy changes from recent CMake releases

Session #4: Thursday, August 26, 12pm – 4pm ET

— Office hours / Q&A session

Slides and recordings will be available after the classes.