Skip to content

CMake Targets Reference

This page documents all available CMake targets in the EmbSec Kit build system.

Global Targets

Core Build Targets

all

Default target that builds all configured components.

cmake --build build

embsec-sdk

Builds the EmbSec SDK library only.

cmake --build build --target embsec-sdk

labs

Builds all lab exercises.

cmake --build build --target labs

clean

Removes all built files.

cmake --build build --target clean

Packaging Targets

package-labs

Creates zip packages for all labs. Places packages in build/packages/.

cmake --build build --target package-labs

package-<lab-name>

Creates a zip package for a specific lab.

cmake --build build --target package-01-buffer-overflow

package

Creates distribution packages using CPack.

cd build && cpack

Installation Targets

install

Installs SDK headers and libraries to the specified prefix.

cmake --install build

Lab-Specific Targets

For each lab (e.g., 01-buffer-overflow), the following targets are available:

Build Targets

<lab-name>

Builds the lab executable and generates binary formats (.bin, .hex).

cmake --build build --target 01-buffer-overflow

Flash Targets

flash-<lab-name>

Flashes the lab to hardware using lm4flash (if available).

cmake --build build --target flash-01-buffer-overflow

QEMU Targets

These targets are only available when building with the QEMU toolchain:

qemu-<lab-name>

Runs the lab in QEMU emulator.

cmake --build build-qemu --target qemu-01-buffer-overflow

debug-<lab-name>

Starts the lab in QEMU with GDB server enabled.

cmake --build build-qemu --target debug-01-buffer-overflow

exploit-<lab-name>

Starts the lab in QEMU with exploit development helpers.

cmake --build build-qemu --target exploit-01-buffer-overflow

Test Targets

test

Runs all tests using CTest.

cd build && ctest

test-labs

Runs all lab tests in QEMU (if QEMU build is configured).

cmake --build build-qemu --target test-labs

Configuration Presets

The project uses CMake presets for common configurations:

Hardware Presets

embedded

Base preset for TM4C123GH6PM hardware.

cmake --preset embedded

tm4c-debug

Debug build for TM4C123GH6PM.

cmake --preset tm4c-debug

tm4c-release

Optimized release build for TM4C123GH6PM.

cmake --preset tm4c-release

QEMU Presets

qemu

Build for QEMU LM3S6965 emulation.

cmake --preset qemu

Host Presets

host-debug

Native host build for testing (SDK only, no labs).

cmake --preset host-debug

docs

Documentation-only build.

cmake --preset docs

Build Options

CMake Variables

Configure these with -D flags:

  • EMBSEC_BUILD_LABS - Build lab exercises (default: ON)
  • EMBSEC_BUILD_TESTS - Build unit tests (default: OFF)
  • EMBSEC_BUILD_DOCS - Build documentation (default: OFF)
  • EMBSEC_VERBOSE - Enable verbose output (default: OFF)
  • CMAKE_BUILD_TYPE - Build type: Debug or Release

Example:

cmake -B build -DCMAKE_BUILD_TYPE=Release -DEMBSEC_BUILD_TESTS=ON

Target Dependencies

Lab Build Dependencies

Each lab target has the following dependency chain:

  1. embsec-sdk - SDK library must be built first
  2. Lab source files compilation
  3. Linking with SDK and TivaWare (if available)
  4. Binary format generation (.bin, .hex)
  5. Size report generation

Package Dependencies

  • package-<lab> depends on <lab> target
  • package-labs depends on all package-<lab> targets
  • Packages include the binary and README files

Advanced Usage

Building Multiple Targets

Build multiple targets in one command:

cmake --build build --target embsec-sdk 01-buffer-overflow 02-format-string

Parallel Builds

Use parallel jobs for faster builds:

cmake --build build -j $(nproc)

Verbose Output

Enable verbose build output:

cmake --build build --verbose

Custom Build Directory

Use a different build directory:

cmake -B my-build -DCMAKE_BUILD_TYPE=Debug
cmake --build my-build

See Also