CMake: Advanced Topics (2024-06-11)

Day 1

Basics

From CMake: Introduction

Exercise: Build It!

Add CMake build to existing source code in https://github.com/jfasch/2024-06-11/tree/main/exercises/straightforward

../../../../_images/exercise-day-1.png

Bringing CMake Information Into C/C++

From CMake: Advanced Topics

Day 2

Morning Awakening

  • Someone to show how WSL can be used.

  • Continue discussion from yesterday: how do I include file from the local directory?

    • #include "file.h"

    • #include <file.h>

    target_include_directories(... INTERFACE ...)

More About Dependencies

Much More … (Various Kinds Of Dependencies)

Demo project: https://github.com/jfasch/2024-06-11/tree/main/livecoding/kinds-of-dependencies

../../../../_images/kinds-of-dependencies.png
digraph "dummy" {
node [
  fontsize = "12"
];
subgraph clusterLegend {
  label = "Legend";
  color = black;
  edge [ style = invis ];
  legendNode0 [ label = "Executable", shape = egg ];
  legendNode1 [ label = "Static Library", shape = octagon ];
  legendNode2 [ label = "Shared Library", shape = doubleoctagon ];
  legendNode3 [ label = "Module Library", shape = tripleoctagon ];
  legendNode4 [ label = "Interface Library", shape = pentagon ];
  legendNode5 [ label = "Object Library", shape = hexagon ];
  legendNode6 [ label = "Unknown Library", shape = septagon ];
  legendNode7 [ label = "Custom Target", shape = box ];
  legendNode0 -> legendNode1 [ style = solid ];
  legendNode0 -> legendNode2 [ style = solid ];
  legendNode0 -> legendNode3;
  legendNode1 -> legendNode4 [ label = "Interface", style = dashed ];
  legendNode2 -> legendNode5 [ label = "Private", style = dotted ];
  legendNode3 -> legendNode6 [ style = solid ];
  legendNode0 -> legendNode7;
}
    "node0" [ label = "a", shape = egg ];
    "node1" [ label = "b", shape = doubleoctagon ];
    "node2" [ label = "c", shape = pentagon ];
    "node1" -> "node2"  // b -> c
    "node3" [ label = "d", shape = octagon ];
    "node1" -> "node3" [ style = dotted ] // b -> d
    "node0" -> "node1" [ style = dotted ] // a -> b
}

The CMake Language

From The Language

Day 3

Morning Awakening

The CMake Language, Continued

From The Language

One example of a function …

External Dependencies

From CMake: Advanced Topics

Code Generators

Unit Tests