[cmake-developers] How to handle dependencies of protobuf files ?

Alexander Neundorf neundorf at kde.org
Tue May 15 15:45:06 EDT 2018


Hi,

I stumbled upon a problem with protobuf files, I attached a testcase.
There is a MyBase.proto, which is "imported" by Complex.proto.
If MyBase.proto is modified, protoc is run again in MyBase.proto, but not on 
Complex.proto, although it should.
You can have a look at the attached example.

The message MyData (in Complex.proto) has a member MyBase b1.
If I rename the message MyBase (in MyBase.proto) e.g. to MyBaseXYZ, then the 
build fails, because Complex.pb.h was not regenerated, so it still refered to 
the now not existing class MyBase.

Is there already a solution to handle this ?

I think to do it properly, there would have to be a dependency scanning for 
proto files like there is for C/C++ headers.
Parsing at the proto-files at cmake time wouldn't be good enough (since editing 
a proto file doesn't trigger a cmake run).

Comments ?

Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: protodeps.tar.gz
Type: application/x-compressed-tar
Size: 897 bytes
Desc: not available
URL: <https://cmake.org/pipermail/cmake-developers/attachments/20180515/a1c8dccf/attachment.bin>


More information about the cmake-developers mailing list