diff options
Diffstat (limited to 'Help/guide/tutorial/A Basic Starting Point.rst')
-rw-r--r-- | Help/guide/tutorial/A Basic Starting Point.rst | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Help/guide/tutorial/A Basic Starting Point.rst b/Help/guide/tutorial/A Basic Starting Point.rst index e5f7b91..20e4129 100644 --- a/Help/guide/tutorial/A Basic Starting Point.rst +++ b/Help/guide/tutorial/A Basic Starting Point.rst @@ -7,6 +7,7 @@ required. This will be the starting point for our tutorial. Create a ``CMakeLists.txt`` file in the ``Step1`` directory that looks like: .. code-block:: cmake + :caption: CMakeLists.txt cmake_minimum_required(VERSION 3.10) @@ -33,6 +34,7 @@ First, modify the ``CMakeLists.txt`` file to use the :command:`project` command to set the project name and version number. .. literalinclude:: Step2/CMakeLists.txt + :caption: CMakeLists.txt :language: cmake :end-before: # specify the C++ standard @@ -40,6 +42,7 @@ Then, configure a header file to pass the version number to the source code: .. literalinclude:: Step2/CMakeLists.txt + :caption: CMakeLists.txt :language: cmake :start-after: # to the source code :end-before: # add the executable @@ -49,6 +52,7 @@ must add that directory to the list of paths to search for include files. Add the following lines to the end of the ``CMakeLists.txt`` file: .. literalinclude:: Step2/CMakeLists.txt + :caption: CMakeLists.txt :language: cmake :start-after: # so that we will find TutorialConfig.h @@ -56,6 +60,7 @@ Using your favorite editor, create ``TutorialConfig.h.in`` in the source directory with the following contents: .. literalinclude:: Step2/TutorialConfig.h.in + :caption: TutorialConfig.h.in :language: c++ When CMake configures this header file the values for @@ -69,6 +74,7 @@ Finally, let's print out the executable name and version number by updating ``tutorial.cxx`` as follows: .. literalinclude:: Step2/tutorial.cxx + :caption: tutorial.cxx :language: c++ :start-after: { :end-before: // convert input to double @@ -81,6 +87,7 @@ Next let's add some C++11 features to our project by replacing ``atof`` with ``#include <cstdlib>``. .. literalinclude:: Step2/tutorial.cxx + :caption: tutorial.cxx :language: c++ :start-after: // convert input to double :end-before: // calculate square root @@ -94,6 +101,7 @@ to ``True``. Make sure to add the ``CMAKE_CXX_STANDARD`` declarations above the call to ``add_executable``. .. literalinclude:: Step2/CMakeLists.txt + :caption: CMakeLists.txt :language: cmake :end-before: # configure a header file to pass some of the CMake settings |