summaryrefslogtreecommitdiffstats
path: root/Help/guide/tutorial/Adding a Library.rst
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-18 16:28:02 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-18 16:31:45 (GMT)
commit73898c4922a8d495d4a5907ca8f072d1c4822ec1 (patch)
tree32261eb84a5043961a575e3727946d7f0304bf92 /Help/guide/tutorial/Adding a Library.rst
parentd64d2d12c39f54f953fa946cf01fedf33ee2db70 (diff)
downloadCMake-73898c4922a8d495d4a5907ca8f072d1c4822ec1.zip
CMake-73898c4922a8d495d4a5907ca8f072d1c4822ec1.tar.gz
CMake-73898c4922a8d495d4a5907ca8f072d1c4822ec1.tar.bz2
Tutorial: Make code snippets linkable
Extend the change from commit 9e5bbb69ea (Tutorial: Add captions for code blocks, 2021-06-11) to also add a Sphinx named target to code blocks. Name each target after the change the code block makes.
Diffstat (limited to 'Help/guide/tutorial/Adding a Library.rst')
-rw-r--r--Help/guide/tutorial/Adding a Library.rst7
1 files changed, 7 insertions, 0 deletions
diff --git a/Help/guide/tutorial/Adding a Library.rst b/Help/guide/tutorial/Adding a Library.rst
index 02f7ed1..1806361 100644
--- a/Help/guide/tutorial/Adding a Library.rst
+++ b/Help/guide/tutorial/Adding a Library.rst
@@ -17,6 +17,7 @@ directory:
.. literalinclude:: Step3/MathFunctions/CMakeLists.txt
:caption: MathFunctions/CMakeLists.txt
+ :name: MathFunctions/CMakeLists.txt
:language: cmake
To make use of the new library we will add an :command:`add_subdirectory`
@@ -27,6 +28,7 @@ last few lines of the top-level ``CMakeLists.txt`` file should now look like:
.. code-block:: cmake
:caption: CMakeLists.txt
+ :name: CMakeLists.txt-add_subdirectory
# add the MathFunctions library
add_subdirectory(MathFunctions)
@@ -50,6 +52,7 @@ occurrence. The first step is to add an option to the top-level
.. literalinclude:: Step3/CMakeLists.txt
:caption: CMakeLists.txt
+ :name: CMakeLists.txt-option
:language: cmake
:start-after: # should we use our own math functions
:end-before: # add the MathFunctions library
@@ -66,6 +69,7 @@ file to look like the following:
.. literalinclude:: Step3/CMakeLists.txt
:caption: CMakeLists.txt
+ :name: CMakeLists.txt-target_link_libraries-EXTRA_LIBS
:language: cmake
:start-after: # add the MathFunctions library
@@ -81,6 +85,7 @@ need it:
.. literalinclude:: Step3/tutorial.cxx
:caption: tutorial.cxx
+ :name: tutorial.cxx-ifdef-include
:language: c++
:start-after: // should we include the MathFunctions header
:end-before: int main
@@ -90,6 +95,7 @@ function is used:
.. literalinclude:: Step3/tutorial.cxx
:caption: tutorial.cxx
+ :name: tutorial.cxx-ifdef-const
:language: c++
:start-after: // which square root function should we use?
:end-before: std::cout << "The square root of
@@ -99,6 +105,7 @@ Since the source code now requires ``USE_MYMATH`` we can add it to
.. literalinclude:: Step3/TutorialConfig.h.in
:caption: TutorialConfig.h.in
+ :name: TutorialConfig.h.in-cmakedefine
:language: c++
:lines: 4