FindProtobuf: Fail protobuf_generate early if protoc is missing

This commit is contained in:
JiaRui Liu 2024-10-08 08:33:35 +08:00
parent 943fd14320
commit 4a1177246d

View File

@ -292,6 +292,12 @@ function(protobuf_generate)
return()
endif()
if(NOT TARGET protobuf::protoc)
message(SEND_ERROR "protoc executable not found. "
"Please define the Protobuf_PROTOC_EXECUTABLE variable or ensure that protoc is in CMake's search path.")
return()
endif()
if(protobuf_generate_APPEND_PATH)
# Create an include path for each file specified
foreach(_file ${protobuf_generate_PROTOS})