[CMake] Protobufs and nested file structure
Alex Shaver
alexshaver at gmail.com
Wed Oct 12 10:30:19 EDT 2016
(cmake 3.5, but tested from repo and had same issue, generating UNIX
Makefiles, protobuf 3)
When I have protobufs more than one folder deep (eg, folder with cmake has
folder with protobufs and another folder which also has more protobufs),
cmake has some trouble generating the correct make files.
Suppose in my folder 'protos' with the CMakeLists.txt that generates from
protobuf, I have folders Alpha and Beta. Beta contains Ball.proto; Alpha
contains Axle.proto and folder Aleph with Anchor.proto. When CMake
generates the build directory for protos, it puts Ball.pb.{h,cpp} and
Axle.pb.* in the top level of the protos build folder, a folder Aleph with
Anchor.pb.* . However, the make instructions look for Anchor.pb.* in the
top-level folder, and it fails to find Anchor.pb.cpp for Anchor.pb.o . If I
go in and manually edit the failing line of the make file, make is
successful.
Second, supposing within these directories there are two messages with the
same name, but belonging to separate protobuf 'packages.' CMake complains
that it has already generated a build rule for the given protobuf. I think
this shares the same root issue of cmake respecting nested folder
structures within.
I can think of various solutions to these problems on my end, but it would
be ideal not to have to rearrange the file structure, nor build many
subprojects linked together. Is there a way to get cmake to reproduce the
existing file structure and build as one project?
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161012/f6363ce1/attachment.html>
More information about the CMake
mailing list