CMake Presets Reference

The Sol3 SDK uses CMake presets to provide standardized build configurations while allowing user customization. The SDK leverages preset inheritance and “includes” to separate SDK build logic from user project configuration.

SDK Base Presets

The SDK provides base presets in sol3-sdk/CMakePresets.json that define:

  • Compiler selection (Clang)

  • vcpkg integration and toolchain configuration

  • Standard C++17 build settings

  • RelWithDebInfo (default), Debug, and Release configurations

  • Cross-compilation presets for ARM64 (Sol3 target)

Preset

Target

Use Case

arm64

ARM64/QRB5165

Sol3 platform development

arm64-debug

ARM64/QRB5165

Sol3 debugging with symbols

arm64-release

ARM64/QRB5165

Sol3 optimized builds

x64

x86_64/Host

Desktop development

x64-debug

x86_64/Host

Desktop debugging

x64-release

x86_64/Host

Desktop optimized builds

These presets can be used with the --preset flag passed to cmake:

cmake --preset x64
cmake --build --preset x64
# Build artifacts will go in out/build/x64

Test Presets

The SDK provides matching test presets (one per configure preset):

Test preset

Configure preset

x64, x64-debug, x64-release

corresponding x64*

arm64, arm64-debug, arm64-release

corresponding arm64*

Each inherits a hidden test-<arch>-sysroot base that injects the sysroot into the test environment: LD_LIBRARY_PATH for the sysroot libraries, plus QEMU_LD_PREFIX for arm64 so the qemu binfmt handler can run ARM64 binaries on an x64 host.

Run tests through the preset so this environment is applied:

ctest --preset x64
ctest --preset x64 -R camera_server_client_integration

Important

Cross builds link against the sysroot with no rpath. A bare ctest or ctest --test-dir <dir> does not set the sysroot environment and will fail with loader errors (e.g. libgbm.so.1: cannot open shared object file). Always run cross-built tests via ctest --preset <arch>.

User Integration

User projects include SDK presets using the include directive in their CMakePresets.json:

{
  "version": 4,
  "include": ["sol3-sdk/CMakePresets.json"],
  "configurePresets": [
    {
      "name": "x64-custom",
      "inherits": "x64",
      "cacheVariables": {
        "MY_PROJECT_FEATURE": "ON"
      }
    }
  ]
}
cmake --preset x64-custom
cmake --build --preset x64-custom
# Build artifacts will go in out/build/x64-custom