I've been working to prevent our CMake system at work from always regenerating the Java wrapper classes for our protobufs; as it stands, a single change in a C++ unit test requires rebuilding a couple hundred of these. The Python and C++ protoc commands are not executed in the same circumstances.
Since I don't use the Java class files, I was not paying too close attention; but I've finally figured out the issue: when compiling XMessage.proto
which contains a protobuf called XMessage
, protoc generates the output file as XMessageOuterClass.java
(to match the name used for the wrapper class). This does not match the expected output name specified in CMake, and so it always rebuilds.
My question is: how can I tell, from a CMake level, whether the protobuf will or will not have this name mangling, so that I can specify the command's OUTPUT
correctly and prevent unneeded rebuilding?