From 4a1177246da0bee6cd48a122b9dcd12f105ab738 Mon Sep 17 00:00:00 2001 From: JiaRui Liu Date: Tue, 8 Oct 2024 08:33:35 +0800 Subject: FindProtobuf: Fail protobuf_generate early if protoc is missing --- Modules/FindProtobuf.cmake | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index bdad4de..197e71f 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -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}) -- cgit v0.12