I want to use protobuf
in my C++ library. All dependencies so far are included using cmake's FetchContent
module. I want to do the same with protobuf
. However, I run into the following problem: Unknown CMake command "protobuf_generate_cpp".
Any hints on how to solve this?
Excerpt of my CMakeLists.txt
:
FetchContent_Declare(fmt
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
GIT_TAG 9.0.0)
FetchContent_Declare(protobuf
GIT_REPOSITORY https://github.com/protocolbuffers/protobuf.git
GIT_TAG v21.4)
FetchContent_MakeAvailable(fmt protobuf)
include_directories(${Protobuf_INCLUDE_DIRS})
include_directories(${CMAKE_CURRENT_BINARY_DIR})
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS message.proto)