mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-01 11:50:11 -05:00
Tutorial: Clarify Step 5
This commit is contained in:
@@ -397,16 +397,22 @@ from ``mysqrt.cxx``:
|
|||||||
#cmakedefine HAVE_LOG
|
#cmakedefine HAVE_LOG
|
||||||
#cmakedefine HAVE_EXP
|
#cmakedefine HAVE_EXP
|
||||||
|
|
||||||
Modify ``mysqrt.cxx`` to include cmath. Next, in that same file in the
|
If ``log`` and ``exp`` are available on the system, then we will use them to
|
||||||
``mysqrt`` function we can provide an alternate implementation based on
|
compute the square root in the ``mysqrt`` function. Add the following code to
|
||||||
``log`` and ``exp`` if they are available on the system using the following
|
the ``mysqrt`` function in ``MathFunctions/mysqrt.cxx`` (don't forget the
|
||||||
code (don't forget the ``#endif`` before returning the result!):
|
``#endif`` before returning the result!):
|
||||||
|
|
||||||
.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
|
.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
|
||||||
:language: c++
|
:language: c++
|
||||||
:start-after: // if we have both log and exp then use them
|
:start-after: // if we have both log and exp then use them
|
||||||
:end-before: // do ten iterations
|
:end-before: // do ten iterations
|
||||||
|
|
||||||
|
We will also need to modify ``mysqrt.cxx`` to include ``cmath``.
|
||||||
|
|
||||||
|
.. literalinclude:: Step6/MathFunctions/mysqrt.cxx
|
||||||
|
:language: c++
|
||||||
|
:end-before: #include <iostream>
|
||||||
|
|
||||||
Run the :manual:`cmake <cmake(1)>` executable or the
|
Run the :manual:`cmake <cmake(1)>` executable or the
|
||||||
:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
|
:manual:`cmake-gui <cmake-gui(1)>` to configure the project and then build it
|
||||||
with your chosen build tool and run the Tutorial executable.
|
with your chosen build tool and run the Tutorial executable.
|
||||||
|
|||||||
Reference in New Issue
Block a user