[cmake-developers] [CMake 0015161]: FindProtobuf: Generated source not regenerated on library update
Mantis Bug Tracker
mantis at public.kitware.com
Wed Sep 17 00:20:16 EDT 2014
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=15161
======================================================================
Reported By: hansmi
Assigned To:
======================================================================
Project: CMake
Issue ID: 15161
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2014-09-17 00:20 EDT
Last Modified: 2014-09-17 00:20 EDT
======================================================================
Summary: FindProtobuf: Generated source not regenerated on
library update
Description:
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.
Proposed patch:
$ diff -u FindProtobuf.cmake.orig FindProtobuf.cmake
--- FindProtobuf.cmake.orig 2014-09-17 06:11:10.282377650 +0200
+++ FindProtobuf.cmake 2014-09-17 06:11:10.282377650 +0200
@@ -118,7 +118,7 @@
"${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()
Steps to Reproduce:
1. Install Protocol Buffers 2.5.0
2. Generate source and header using 2.5.0's protoc binary
3. Install Protocol Buffers 2.6.0
4. Re-build source
Additional Information:
Workaround in case someone's affected by this and can't modify
FindProtobuf.cmake in their environment:
foreach(i ${PROTO_SRCS} ${PROTO_HDRS})
add_custom_command(OUTPUT ${i} DEPENDS ${PROTOBUF_PROTOC_EXECUTABLE} APPEND)
endforeach()
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2014-09-17 00:20 hansmi New Issue
======================================================================
More information about the cmake-developers
mailing list