On Wed, Oct 12, 2011 at 8:46 AM, James Anderson
<[email protected]>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
--
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake