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                                    
======================================================================

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to