diff options
author | Betsy McPhail <betsy.mcphail@kitware.com> | 2019-07-18 19:40:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-19 15:49:05 (GMT) |
commit | 442c0f0d463d8f08a6c47b371cdb13a9ec4cea41 (patch) | |
tree | d8588d77931740496d9394e522465ca5728b16c7 /Help/guide | |
parent | bc64401c3d9355f3c8fd6a205b8ef9d24a795204 (diff) | |
download | CMake-442c0f0d463d8f08a6c47b371cdb13a9ec4cea41.zip CMake-442c0f0d463d8f08a6c47b371cdb13a9ec4cea41.tar.gz CMake-442c0f0d463d8f08a6c47b371cdb13a9ec4cea41.tar.bz2 |
Tutorial: Improve Step 4
* Clarify directions
Diffstat (limited to 'Help/guide')
-rw-r--r-- | Help/guide/tutorial/index.rst | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/Help/guide/tutorial/index.rst b/Help/guide/tutorial/index.rst index cbeec4d..9118c4f 100644 --- a/Help/guide/tutorial/index.rst +++ b/Help/guide/tutorial/index.rst @@ -293,17 +293,17 @@ Now we can start adding install rules and testing support to our project. Install Rules ------------- -The install rules are fairly simple for MathFunctions we want to install the +The install rules are fairly simple: for MathFunctions we want to install the library and header file and for the application we want to install the executable and configured header. -So to ``MathFunctions/CMakeLists.txt`` we add: +So to the end of ``MathFunctions/CMakeLists.txt`` we add: .. literalinclude:: Step5/MathFunctions/CMakeLists.txt :language: cmake :start-after: # install rules -And the to top-level ``CMakeLists.txt`` we add: +And to the end of the top-level ``CMakeLists.txt`` we add: .. literalinclude:: Step5/CMakeLists.txt :language: cmake @@ -314,21 +314,25 @@ That is all that is needed to create a basic local install of the tutorial. Run **cmake** or **cmake-gui** to configure the project and then build it with your chosen build tool. Run the install step by typing -``cmake --install .`` or from the command line, or build the ``INSTALL`` -target from an IDE. This will install the appropriate header files, libraries, -and executables. +``cmake --install .`` (introduced in 3.15, older versions of CMake must use +``make install``) from the command line, or build the ``INSTALL`` target from +an IDE. This will install the appropriate header files, libraries, and +executables. -Verify that the installed Tutorial runs. Note: The CMake variable -``CMAKE_INSTALL_PREFIX`` is used to determine the root of where the files will -be installed. If using ``cmake --install`` a custom installation directory can -be given via ``--prefix`` argument. +The CMake variable ``CMAKE_INSTALL_PREFIX`` is used to determine the root of +where the files will be installed. If using ``cmake --install`` a custom +installation directory can be given via ``--prefix`` argument. For +multi-configuration tools, use the ``--config`` argument to specify the +configuration. + +Verify that the installed Tutorial runs. Testing Support --------------- Next let's test our application. At the end of the top-level CMakeLists file we -can add a number of basic tests to verify that the application is -working correctly. +can enable testing and then add a number of basic tests to verify that the +application is working correctly. .. literalinclude:: Step5/CMakeLists.txt :language: cmake @@ -339,7 +343,7 @@ otherwise crash, and has a zero return value. This is the basic form of a CTest test. The next test makes use of the ``PASS_REGULAR_EXPRESSION`` test property to -verify that the output of the test contains certain strings, in this case: +verify that the output of the test contains certain strings. In this case, verifying that the the usage message is printed when an incorrect number of arguments are provided. @@ -349,7 +353,11 @@ invocation of ``do_test``, another test is added to the project with a name, input, and expected results based on the passed arguments. Rebuild the application and then cd to the binary directory and run -``ctest -N`` and ``ctest -VV``. +``ctest -N`` and ``ctest -VV``. For multi-config generators (e.g. Visual +Studio), the configuration type must be specified. To run tests in Debug mode, +for example, use ``ctest -C Debug -VV`` from the build directory (not the +Debug subdirectory!). Alternatively, build the ``RUN_TESTS`` target from the +IDE. Adding System Introspection (Step 5) ==================================== |