The CMake Configuration

Configure the Root Project

The root CMakeLists.txt connects the Erbsland Core libraries and your application. Add Erbsland Core first so its targets exist when CMake configures elgrep.

<project>/CMakeLists.txt
cmake_minimum_required(VERSION 3.28)

project(ElGrepProject LANGUAGES CXX)

add_subdirectory(erbsland)
add_subdirectory(elgrep)

Add the Erbsland Core Aggregator

Create erbsland/CMakeLists.txt as the single place where the project registers Erbsland Core libraries. When you add an extension later, add its subdirectory below core in this file.

<project>/erbsland/CMakeLists.txt
add_subdirectory(core EXCLUDE_FROM_ALL)

EXCLUDE_FROM_ALL keeps Core’s own auxiliary targets out of regular application builds. Core also detects that it is embedded and leaves its tests, demos, precompiled headers, and developer settings disabled unless your project explicitly enables them.

Configure the Application Target

The application CMake file declares the executable and passes it to Core’s application setup helper.

<project>/elgrep/CMakeLists.txt
add_executable(elgrep
        src/ElGrepApp.cpp
        src/ElGrepApp.hpp
        src/main.cpp
)

erbsland_core_setup_application(TARGET elgrep)

erbsland_core_setup_application() links the available Core target, enables C++20, disables C++ module scanning for the target, and selects UTF-8 source and execution character sets on MSVC. The helper works with both source integration and an installed Core package, so the application CMake file does not need to choose between their different target names.

Build the Application Framework →