For each protobuf file, our cmake setup creates a dedicated target generating both the header and implementation file and adds these as dependencies directly to some other target (typically a library). At least for the Make generator, this under the covers introduces a dependency edge from the library to an object file generated from compiling the protobuf implementation file.
If a protobuf file has an import for another protobuf file, the generated C++ will include the corresponding generated header file. We currently do not ensure all input files (e.g., headers) are generated from their sources before compiling users.
This can lead to faulty builds where
1) a consuming protobuf file is compiled before its inputs are generated, or
2) in incremental builds, a consuming protobuf is compiled from an outdated generated protobuf header file.
For an example of 1) a compile of 18220a50d3033a4debffd7cc61f1514ede7e2c2b will fail at -j1.
It seems we should ensure all protobuf files are created before allowing compilation of users.