CMake Reference

This page documents the project-specific CMake configuration from CMakeLists.txt and CMakePresets.json.

Project Options

* BUILD_KD_TREE_LIBRARY is a dependent option and is forced ON when the executable or tests are enabled.

Standard CMake Variables

Variable

Description

CMAKE_BUILD_TYPE

Used for single-config generators (for example Ninja). Presets set Release or Debug where appropriate. Multi-config generators ignore this at configure time.

Presets Overview

Configure presets (from CMakePresets.json):

Preset

Inherits

Main purpose

release

base

Standard release build (CPP backend).

debug

base

Debug build, KD_TREE_LOGGING_LEVEL=DEBUG.

release-omp

release

Release build with OpenMP backend.

release-tbb

release

Release build with TBB backend.

test

release-tbb

Enables tests and sets logging to WARN.

python

release

Python interface (CPP backend), CLI off.

python-tbb

python

Python interface with TBB backend.

python-omp

python

Python interface with OpenMP backend.

docs

base

Docs-only configure preset.

Build presets:

  • release, debug, release-omp, release-tbb

  • test

  • python-cpp, python-omp, python-tbb

  • docs-build (build target: Sphinx)

Test presets:

  • test

Workflow presets:

  • build-release-default

  • build-release-omp

  • build-release-tbb

  • build-and-test

  • build-python-interface

  • build-docs

Typical Commands

Preferred: run workflows directly:

# cmake --workflow --preset <preset-name>
cmake --workflow --preset build-release-default
cmake --workflow --preset build-release-tbb
cmake --workflow --preset build-release-omp
cmake --workflow --preset build-and-test
cmake --workflow --preset build-python-interface
cmake --workflow --preset build-docs

Alternative: manual configure/build (only when custom flags are needed):

cmake -S . -B build/custom \
  -DCMAKE_BUILD_TYPE=Release \
  -DKD_TREE_PARALLELIZATION=OMP \
  -DKD_TREE_LOGGING_LEVEL=INFO \
  -DBUILD_KD_TREE_EXECUTABLE=ON \
  -DBUILD_KD_TREE_TESTS=OFF

cmake --build build/custom