title: How to automatically move *.pb.h and *.pb.h under /include and /src directories?
body: <p>I am developing a library which uses Google Protocol Buffers (<code>protobuf</code>) and CMake. The project has the following directory tree.</p>
  
  <pre><code>MyProject/
  MyProject/include/myproject/
  MyProject/include/myproject/some_classes.h
  MyProject/src/
  MyProject/src/some_classes.cc
  MyProject/src/foo.proto
  MyProject/CMakeList.txt
  </code></pre>
  
  <p><code>CMakeList.txt</code> has the following lines to generate protobuf source and header files.</p>
  
  <pre><code>include_directories(${libCHEC_SOURCE_DIR}/include)
  aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/src SOURCES)
  
  find_package(Protobuf REQUIRED)
  file(GLOB ProtoFiles "${CMAKE_CURRENT_SOURCE_DIR}/src/*.proto")
  protobuf_generate_cpp(ProtoSources ProtoHeaders ${ProtoFiles})
  list(APPEND EXTLIBS ${PROTOBUF_LIBRARIES})
  
  add_library(MyLibrary SHARED ${SOURCES} ${ProtoSources})
  target_link_libraries(MyLibrary ${EXTLIBS})
  </code></pre>
  
  <p>When I execute <code>cmake</code>, <code>foo.pb.h</code> and <code>foo.pb.cc</code> are generated under the build directory (i.e. the directory where I executed <code>cmake</code>). It looks that this is the default behavior. But I would like to put <code>foo.pb.h</code> and <code>foo.pb.cc</code> under <code>include/myproject</code> and <code>src</code> directories, respectively.</p>
  
  <p>How can I change the locations of the files generated by <code>protoc</code>?</p>