0Pricing
C++ Academy · Lesson

CMake Project Layout and CMakeLists.txt

Lay out source trees and write basic CMakeLists files.

Why CMake?

CMake is the de facto standard build system generator for C++. It produces project files for Make, Ninja, Visual Studio, Xcode — from a single description.

Minimal CMakeLists.txt

The smallest useful CMakeLists.txt for a single executable.

cmake_minimum_required(VERSION 3.20)
project(MyApp LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

add_executable(myapp main.cpp)

All lessons in this course

  1. CMake Project Layout and CMakeLists.txt
  2. Targets Linking and Visibility PUBLIC PRIVATE
  3. Using vcpkg and Conan for Dependencies
  4. Generating IDE Files and Cross-Platform Builds
← Back to C++ Academy