<br><br><div class="gmail_quote">On Wed, Oct 12, 2011 at 8:46 AM, James Anderson <span dir="ltr">&lt;<a href="mailto:japanwikidonate@gmail.com">japanwikidonate@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<span style="font-family:monospace;font-size:12px;white-space:pre-wrap">PROTOBUF_GENERATE_CPP does not seem to work at all in ubuntu. I was working with 2.8.3 and since it wasn&#39;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.</span><div>


<span style="font-family:monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="font-family:monospace;font-size:12px;white-space:pre-wrap">Here&#39;s the relevant segment:</span></div>

<div><span style="font-family:monospace;font-size:12px;white-space:pre-wrap"><br></span></div><div><span style="font-family:monospace;font-size:12px;white-space:pre-wrap"><pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<span style="color:#808000">FIND_PACKAGE</span>(Protobuf)</pre><pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#808000">IF</span>(PROTOBUF_FOUND)</pre>

<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0">    </span><span style="color:#808000">INCLUDE_DIRECTORIES</span>(<span style="color:#800000">${PROTOBUF_INCLUDE_DIRS}</span>)</pre>


<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0">    </span><span style="color:#808000">INCLUDE_DIRECTORIES</span>(<span style="color:#800000">${CMAKE_CURRENT_BINARY_DIR}</span>)</pre>


<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#c0c0c0">    </span><span style="color:#808000">PROTOBUF_GENERATE_CPP</span>(PROTO_SRCS<span style="color:#c0c0c0"> </span>PROTO_HDRS<span style="color:#c0c0c0"> </span>data.proto)</pre>


<pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px"><span style="color:#808000">ENDIF</span>()</pre><pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">
<br></pre><pre style="margin-top:0px;margin-bottom:0px;margin-left:0px;margin-right:0px;text-indent:0px">Yet the protoc compiler is never invoked and the <a href="http://data.pb.cc" target="_blank">data.pb.cc</a> and .h files are never created (even tried without the IF statement).</pre>
</span></div></blockquote><div><br></div><div>James,</div><div><br></div><div>PROTO_SRCS &amp; PROTO_HDRS (in the code snippit you list above) are simply lists of source &amp; header files to generate.  You need to use them in a target in order for CMake to cause them to be generated.</div>
<div><br></div><div>E.g.</div><div><br></div><div>add_executable(foo foo.cc ${PROTO_SRCS} ${PROTO_HDRS})</div><div>target_link_libraries(foo ${PROTOBUF_LIBRARIES})</div><div><br></div><div>Hope that solves your problem.</div>
<div><br></div><div>-- </div></div>Philip Lowman<br>