The Project Structure

Organizing the Example Project

In this tutorial, we will build a small application called signal-board. To keep the project self-contained, the library is included as a Git submodule. This makes the tutorial easy to reproduce while still allowing you to update the library independently when needed.

By the end of this step, your directory structure will look like this:

signal-board-project               # Root directory of the tutorial project
    ├── erbsland-cpp-color-term    # The library as a Git submodule
    │   └── (...)
    ├── signal-board               # The tutorial application
    │   ├── src                    # Application source files
    │   │   └── main.cpp
    │   └── CMakeLists.txt
    └── CMakeLists.txt             # Top-level build configuration

Create the Project Skeleton

  1. Create the project directory and add the library as a submodule:

    $ mkdir signal-board-project
    $ cd signal-board-project
    $ git init
    Initialized empty Git repository in ~/signal-board-project/.git/
    $ git submodule add https://github.com/erbsland-dev/erbsland-cpp-color-term.git erbsland-cpp-color-term
    Cloning into '~/signal-board-project/erbsland-cpp-color-term'...
    ...
    
  2. Create the directory for the tutorial application:

    $ mkdir signal-board
    $ mkdir signal-board/src
    

At this point, your project structure should look like this:

signal-board-project
    ├── erbsland-cpp-color-term    # [new] Library submodule
    └── signal-board               # [new] Application directory
        └── src                    # [new] C++ source directory

Note

If you clone this project later, remember to initialize the submodules:

git submodule update --init --recursive

Write the CMake Configuration →

About the Command-Line Examples

This tutorial uses small command-line examples so the workflow is easy to follow and reproduce. You can use the same project structure with any IDE or editor, as long as the resulting files contain the same content.