[CMake] Protobuf Module
Philip Lowman
philip at yhbt.com
Wed Oct 12 23:12:49 EDT 2011
On Wed, Oct 12, 2011 at 8:46 AM, James Anderson
<japanwikidonate at gmail.com>wrote:
> PROTOBUF_GENERATE_CPP does not seem to work at all in ubuntu. I was working
> with 2.8.3 and since it wasn't working I have compiled the latest cmake
> (2.8.6) but still no luck. I also tried with --debug-output but after
> finding protobuf no other related output.
>
> Here's the relevant segment:
>
> FIND_PACKAGE(Protobuf)
>
> IF(PROTOBUF_FOUND)
>
> INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIRS})
>
> INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
>
> PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS data.proto)
>
> ENDIF()
>
>
> Yet the protoc compiler is never invoked and the data.pb.cc and .h files are never created (even tried without the IF statement).
>
>
James,
PROTO_SRCS & PROTO_HDRS (in the code snippit you list above) are simply
lists of source & header files to generate. You need to use them in a
target in order for CMake to cause them to be generated.
E.g.
add_executable(foo foo.cc ${PROTO_SRCS} ${PROTO_HDRS})
target_link_libraries(foo ${PROTOBUF_LIBRARIES})
Hope that solves your problem.
--
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111012/fcfb197d/attachment.htm>
More information about the CMake
mailing list