Following https://gitlab.kitware.com/cmake/cmake/issues/19875#note_705896 it is
possible to FetchContent protobuf. Is it feasible to use that protobuf
and it’s compiler for the protobuf_generate_cpp and
protobuf_generate_python functions of FindProtobuf?
Those functions expect a protobuf compiler for compilation, but the
compiler will only be available after the targets introduced by
FetchContent have finished compilation.
You can probably set the expected variables to some $<TARGET_FILE:> values. Those functions should be making custom commands rather than direct execution, so that should be fine.
Bincrafters introduced some patches to Protobuf’s CMakeLists in their Conan Protobuf package.
Using Protobuf via Conan enables what described out of the box.
If you rather not using Conan, I guess you could also just pick what you need from their patches.