Closed rgov closed 4 years ago
I confirmed that the generate_protobuf_cpp
function is the only one that is redefined when including Goby3 as a subproject. (See this CMake issue on redefinitions of macros and functions.)
Renaming the function to goby_generate_protobuf_cpp
worked around the issue for me.
I don't think I can do --dccl_out
and --cpp_out
in the same command with the official CMake FindProtobuf module.
I will leave this open for renaming the function to goby_generate_protobuf_cpp
, though.
Protobuf upstream also has their own protobuf-config
shipping with CMake functions in it. It has a unified API rather than a per-language call though.
I think it started showing up in 3.4 if that matters.
Cool, thanks. May be helpful for the future. For now I need to support protobuf as old as 2.6.1 and CMake as old as 3.5.1
cgsn-mooring's FindProtobufLocal.cmake varies slightly from Goby3's FindProtobufGoby.cmake, though they both define the same functions.
One consequence of this is that if you add Goby3 sources to a build with
add_subdirectory()
, the re-defined functions will replace the parent project's definitions.CMake has an official built-in FindProtobuf module as well that has been significantly overhauled. It supports the
PROTOC_OUT_DIR
option now which might do some of what you want.