C++ did not have a sound and widely adopted build system and dependency manager for many years. What we had was considered messy, complex, and limited. The situation has changed with the introduction of Modern CMake and Conan package manager. Both of the tools are free and open-sourced.
CMake is the de-facto standard for C++. It is widely supported by nearly all IDEs and, together with the Ninja generator, delivers probably the fastest build times for large C++ projects. A "Modern CMake" is a subset of old CMake features with the addition of so-called "targets". It equips our projects with easy-to-create, maintain, and build systems.
Conan is a dependency and package manager specifically designed and optimized for accelerating the development and Continuous Integration of C and C++ projects. It can build from a source and perform full binary management. Thanks to that, it can create and reuse any number of different binaries for different configurations and versions of a package, using the same process on all platforms. As it is decentralized, running your server to host your packages and binaries privately without sharing them is easy. Those features make Conan an excellent solution for enterprise needs.
We will use the gitpod.io service for the workshop exercises. CMake, C++ compilers, and other tools will be preinstalled on the Docker image, so there is no need to prepare any special environment for the training.
The training is recommended to all C++ developers and architects. It should be considered mandatory for those who develop or distribute C++ library projects.
Note: This subject is much broader and more detailed than one might initially imagine. We have over 1200 slides of materials and 35+ hands-on workshop tasks to address the agenda. Delivering the entire training scope in just one week is impossible. We strongly recommend cutting it into smaller pieces and taking those in a more extended time (e.g., two 4-day trainings within one or two months).
TRAINING HIGHLIGHTS
- Understanding of the issues with legacy CMake approach and dependency management
- Emphasis on Modern CMake, libraries encapsulation, and transitivity
- Realizing how Conan can improve dependencies handling and package management in your organization
TRAINING AGENDA
The following plan is an initial proposal for the training material. The final agenda is always created based on the individual pre-training analysis of the client's requirements and constraints.
- Modern Project Structure
- How To Handle Dependencies?
- Robust Project Structure
- In-source Vs Out-of-source builds
- Modern CMake (4-5 days)
- Command Line, Generators, and Build Types
- A Minimal Project
- Targets, Aliases, Encapsulation, And Transitivity
- Properties
- Subdirectories
- Generator Expressions
- Testing Support
- Installing And Finding Dependencies
- Custom Tasks
- Version Number and Configured Header Files
- Variables
- Flow control
- Scope
- Functions, Macros, And Argument Handling
- Math, Strings, and Lists
- Modules
- Toolchains And Cross-Compiling
- Presets
- Project Installation
- Debugging And Diagnostics
- External Content
- Advanced CMake (1-2 days)
- Policies
- Custom Build Types
- Checking Existence and Support
- Invoking Arbitrary Code
- Forwarding Command Arguments
- Custom Tasks (Configure Stage)
- Specifying Version Details
- Libraries
- Finding Things
- Find Modules
- External Content
- Packaging
- Build Performance
- Working With Files
- Conan (2 days)
- Conan Environment
- Basic Command Line Usage
- Building and Installing Dependencies
- Versioning and Lock Files
- Deployers and Generators
- Profiles, Settings, Options, Configuration Parameters
- Sharing Conan Configuration
- Build and Host Environments (cross-compilation)
- Conan Recipes
- Using Conan to Configure, Build, and Test Your Project
- Different Ways to Package a Project
- ABI Compatibility
- Conan Graph and Transitivity of Package Traits
- Editable Mode