From e380d7c5baca9de5fcb5826e2d9386a6dd57e48c Mon Sep 17 00:00:00 2001 From: Michael Hanselmann Date: Wed, 17 Sep 2014 06:11:10 +0200 Subject: [PATCH] FindProtobuf: Make outputs depend on protoc executable After updating from Protocol Buffers 2.5.0 to 2.6.0 compilation of the generated source failed: "This file was generated by an older version of protoc which is incompatible with your Protocol Buffer headers. Please regenerate this file with a newer version of protoc.". Turns out the source and headers generated by way of FindProtobuf.cmake:PROTOBUF_GENERATE_CPP aren't updated. Adding a dependency on the compiler executable fixes this issue. --- Modules/FindProtobuf.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index 9b120a605..72ca6ed20 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -183,7 +183,7 @@ function(PROTOBUF_GENERATE_CPP SRCS HDRS) "${CMAKE_CURRENT_BINARY_DIR}/${FIL_WE}.pb.h" COMMAND ${PROTOBUF_PROTOC_EXECUTABLE} ARGS --cpp_out ${CMAKE_CURRENT_BINARY_DIR} ${_protobuf_include_path} ${ABS_FIL} - DEPENDS ${ABS_FIL} + DEPENDS ${ABS_FIL} ${PROTOBUF_PROTOC_EXECUTABLE} COMMENT "Running C++ protocol buffer compiler on ${FIL}" VERBATIM ) endforeach()