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/QRB5165 |
Sol3 platform development |
|
ARM64/QRB5165 |
Sol3 debugging with symbols |
|
ARM64/QRB5165 |
Sol3 optimized builds |
|
x86_64/Host |
Desktop development |
|
x86_64/Host |
Desktop debugging |
|
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 |
|---|---|
|
corresponding |
|
corresponding |
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