mirror of
https://github.com/ttroy50/cmake-examples.git
synced 2025-12-19 04:34:36 +03:00
Update toc and headings #3
This commit is contained in:
@@ -1,14 +1,10 @@
|
|||||||
= Protobuf Code Generation
|
= Protobuf Code Generation
|
||||||
|
|
||||||
:toc:
|
:toc:
|
||||||
:toc-placement!:
|
:toc-placement!:
|
||||||
|
|
||||||
toc::[]
|
toc::[]
|
||||||
|
|
||||||
|
# Introduction
|
||||||
[[intro]]
|
|
||||||
Introduction
|
|
||||||
------------
|
|
||||||
|
|
||||||
This example shows how to generate source files using https://github.com/google/protobuf[protobuf].
|
This example shows how to generate source files using https://github.com/google/protobuf[protobuf].
|
||||||
Protocol Buffers is a data serialization format from Google. A user provides a
|
Protocol Buffers is a data serialization format from Google. A user provides a
|
||||||
@@ -29,9 +25,7 @@ $ tree
|
|||||||
* CMakeLists.txt - Contains the CMake commands you wish to run
|
* CMakeLists.txt - Contains the CMake commands you wish to run
|
||||||
* main.cpp - The source file from the protobuf example.
|
* main.cpp - The source file from the protobuf example.
|
||||||
|
|
||||||
[[requirements]]
|
# Requirements
|
||||||
Requirements
|
|
||||||
~~~~~~~~~~~~
|
|
||||||
|
|
||||||
This example requires the protocol buffers binary and libraries to be installed.
|
This example requires the protocol buffers binary and libraries to be installed.
|
||||||
|
|
||||||
@@ -42,13 +36,9 @@ This can be installed on Ubuntu using
|
|||||||
sudo apt-get install protobuf-compiler sudo apt-get install protobuf-compiler
|
sudo apt-get install protobuf-compiler sudo apt-get install protobuf-compiler
|
||||||
----
|
----
|
||||||
|
|
||||||
[[concepts]]
|
# Concepts
|
||||||
Concepts
|
|
||||||
~~~~~~~~
|
|
||||||
|
|
||||||
[[exported_variables]]
|
## Exported Variables
|
||||||
Exported Variables
|
|
||||||
^^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The variables exported by the CMake protobuf package and used in this example include:
|
The variables exported by the CMake protobuf package and used in this example include:
|
||||||
|
|
||||||
@@ -59,9 +49,7 @@ The variables exported by the CMake protobuf package and used in this example in
|
|||||||
More variables are defined and can be found by examining the documentation at the
|
More variables are defined and can be found by examining the documentation at the
|
||||||
top of your `FindProtobuf.cmake` file.
|
top of your `FindProtobuf.cmake` file.
|
||||||
|
|
||||||
[[generating-protobuf]]
|
## Generating Source
|
||||||
Generating Source
|
|
||||||
^^^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
The protobuf CMake package includes a number of helper functions to make the
|
The protobuf CMake package includes a number of helper functions to make the
|
||||||
code generation easier. In this example we are generating C++ source and use
|
code generation easier. In this example we are generating C++ source and use
|
||||||
@@ -78,9 +66,7 @@ The arguments are:
|
|||||||
* PROTO_HDRS- Name of the variable that will store the .pb.h files.
|
* PROTO_HDRS- Name of the variable that will store the .pb.h files.
|
||||||
* AddressBook.proto - The .proto file to generate code from.
|
* AddressBook.proto - The .proto file to generate code from.
|
||||||
|
|
||||||
[[generated-files]]
|
## Generated Files
|
||||||
Generated Files
|
|
||||||
^^^^^^^^^^^^^^^
|
|
||||||
|
|
||||||
After the `PROTOBUF_GENERATE_CPP` function is called, you will have the above
|
After the `PROTOBUF_GENERATE_CPP` function is called, you will have the above
|
||||||
mentioned variables available. These will be marked as the output to a custom command
|
mentioned variables available. These will be marked as the output to a custom command
|
||||||
@@ -104,9 +90,7 @@ When changes are made to the .proto file, the associated source files will be
|
|||||||
autogenerated again. However, if no changes are made to the .proto file and you re-run
|
autogenerated again. However, if no changes are made to the .proto file and you re-run
|
||||||
make, then nothing will be done.
|
make, then nothing will be done.
|
||||||
|
|
||||||
[[building-the-example]]
|
# Building the Example
|
||||||
Building the Example
|
|
||||||
~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
[source,bash]
|
[source,bash]
|
||||||
----
|
----
|
||||||
|
|||||||
Reference in New Issue
Block a user