Преглед изворни кода

Tutorial: Add reference links for step 1 commands

Markus Ferrell пре 3 година
родитељ
комит
bc0aef31ee
1 измењених фајлова са 19 додато и 7 уклоњено
  1. 19 7
      Help/guide/tutorial/A Basic Starting Point.rst

+ 19 - 7
Help/guide/tutorial/A Basic Starting Point.rst

@@ -19,8 +19,19 @@ required. This will be the starting point for our tutorial. Create a
   add_executable(Tutorial tutorial.cxx)
   add_executable(Tutorial tutorial.cxx)
 
 
 
 
-Note that this example uses lower case commands in the ``CMakeLists.txt`` file.
-Upper, lower, and mixed case commands are supported by CMake. The source
+Any project's top most ``CMakeLists.txt`` must start by specifying
+a minimum CMake version using :command:`cmake_minimum_required`. This ensures
+that the later CMake functions are run with a compatible version of CMake.
+
+To start a project, we use :command:`project` to set the project name. This
+call is required with every project and should be called soon after
+:command:`cmake_minimum_required`.
+
+Lastly, we use :command:`add_executable` to specify we want an executable
+named Tutorial generated using ``tutorial.cxx`` as the source.
+
+Note that this example uses lower case commands in the ``CMakeLists.txt``
+file. Upper, lower, and mixed case commands are supported by CMake. The source
 code for ``tutorial.cxx`` is provided in the ``Step1`` directory and can be
 code for ``tutorial.cxx`` is provided in the ``Step1`` directory and can be
 used to compute the square root of a number.
 used to compute the square root of a number.
 
 
@@ -79,7 +90,7 @@ to set the project name and version number.
   :language: cmake
   :language: cmake
   :end-before: # specify the C++ standard
   :end-before: # specify the C++ standard
 
 
-Then, configure a header file to pass the version number to the source
+Then use :command:`configure_file` to pass the version number to the source
 code:
 code:
 
 
 .. literalinclude:: Step2/CMakeLists.txt
 .. literalinclude:: Step2/CMakeLists.txt
@@ -91,7 +102,8 @@ code:
 
 
 Since the configured file will be written into the binary tree, we
 Since the configured file will be written into the binary tree, we
 must add that directory to the list of paths to search for include
 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:
+files. Use :command:`target_include_directories` to add the following lines to
+the end of the ``CMakeLists.txt`` file:
 
 
 .. literalinclude:: Step2/CMakeLists.txt
 .. literalinclude:: Step2/CMakeLists.txt
   :caption: CMakeLists.txt
   :caption: CMakeLists.txt
@@ -107,9 +119,9 @@ directory with the following contents:
   :name: TutorialConfig.h.in
   :name: TutorialConfig.h.in
   :language: c++
   :language: c++
 
 
-When CMake configures this header file the values for
+When CMake configures this header file, the values for
 ``@Tutorial_VERSION_MAJOR@`` and ``@Tutorial_VERSION_MINOR@`` will be
 ``@Tutorial_VERSION_MAJOR@`` and ``@Tutorial_VERSION_MINOR@`` will be
-replaced.
+replaced with the corresponding version numbers from the project.
 
 
 Next modify ``tutorial.cxx`` to include the configured header file,
 Next modify ``tutorial.cxx`` to include the configured header file,
 ``TutorialConfig.h``.
 ``TutorialConfig.h``.
@@ -141,7 +153,7 @@ Next let's add some C++11 features to our project by replacing ``atof`` with
 We will need to explicitly state in the CMake code that it should use the
 We will need to explicitly state in the CMake code that it should use the
 correct flags. The easiest way to enable support for a specific C++ standard
 correct flags. The easiest way to enable support for a specific C++ standard
 in CMake is by using the :variable:`CMAKE_CXX_STANDARD` variable. For this
 in CMake is by using the :variable:`CMAKE_CXX_STANDARD` variable. For this
-tutorial, set the :variable:`CMAKE_CXX_STANDARD` variable in the
+tutorial, :command:`set` the :variable:`CMAKE_CXX_STANDARD` variable in the
 ``CMakeLists.txt`` file to ``11`` and :variable:`CMAKE_CXX_STANDARD_REQUIRED`
 ``CMakeLists.txt`` file to ``11`` and :variable:`CMAKE_CXX_STANDARD_REQUIRED`
 to ``True``. Make sure to add the ``CMAKE_CXX_STANDARD`` declarations above the
 to ``True``. Make sure to add the ``CMAKE_CXX_STANDARD`` declarations above the
 call to ``add_executable``.
 call to ``add_executable``.