I thiiiink I had a very similar problem on GitHub Actions after I added Perfetto that boiled down to a toolchain mismatch: my main target was set to C++20 but the dependency target was not.
I believe I solved it by setting the following in CMakeLists.txt before any targets are specified:
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
see: Juceaide fails to build on Windows - plugin demo - master branch
