CMake profile configure

CMake can output JSON in google-trace format that can help understand what tasks a CMake project configuration is taking time on.

cmake -B build --profiling-output=perf.json --profiling-format=google-trace

View profiler data: type in web browser (Chrome or Edge) address bar “about:tracing” and Load “perf.json”.

Other google-trace viewers can also be used.

For example, in a minimal C++ project on a Windows computer:

cmake_minimum_required(VERSION 3.18)
project(b LANGUAGES CXX)

Approximate percent of CMake configure time spent:

  • system ID: 1%
  • Generator identify: 2%
  • Compiler identification: 50%
  • Compiler capabilities: 47%