View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0015161CMakeCMakepublic2014-09-17 00:202015-03-02 08:57
Reporterhansmi 
Assigned ToBrad King 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 3.1Fixed in VersionCMake 3.1 
Summary0015161: FindProtobuf: Generated source not regenerated on library update
DescriptionAfter 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 Reproduce1. 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 InformationWorkaround 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()
TagsNo tags attached.
Attached Files

 Relationships

  Notes
(0036821)
Brad King (manager)
2014-09-18 09:18

Applied, thanks:

FindProtobuf: Make outputs depend on protoc executable
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e380d7c5 [^]
(0038126)
Robert Maynard (manager)
2015-03-02 08:57

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2014-09-17 00:20 hansmi New Issue
2014-09-18 09:18 Brad King Note Added: 0036821
2014-09-18 09:18 Brad King Assigned To => Brad King
2014-09-18 09:18 Brad King Status new => resolved
2014-09-18 09:18 Brad King Resolution open => fixed
2014-09-18 09:18 Brad King Fixed in Version => CMake 3.1
2014-09-18 09:18 Brad King Target Version => CMake 3.1
2015-03-02 08:57 Robert Maynard Note Added: 0038126
2015-03-02 08:57 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team