summaryrefslogtreecommitdiffstats
path: root/Help/guide/tutorial/Step3
diff options
context:
space:
mode:
authorBetsy McPhail <betsy.mcphail@kitware.com>2019-06-18 14:49:40 (GMT)
committerBrad King <brad.king@kitware.com>2019-06-19 12:57:12 (GMT)
commiteef3e020c21d2fdba19aab0daf1b99f8de0a16fe (patch)
tree30c79204ed261551c611d6f1f159ef682c8b2b74 /Help/guide/tutorial/Step3
parent862cfc0e6c3f275db73281f3b9b989704251ab6a (diff)
downloadCMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.zip
CMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.tar.gz
CMake-eef3e020c21d2fdba19aab0daf1b99f8de0a16fe.tar.bz2
Help: Populate tutorial guide text
Migrate tutorial text from individual `directions.txt` files to the main tutorial document. Add some comments to source code to provide anchors for inclusion.
Diffstat (limited to 'Help/guide/tutorial/Step3')
-rw-r--r--Help/guide/tutorial/Step3/CMakeLists.txt2
-rw-r--r--Help/guide/tutorial/Step3/directions.txt26
-rw-r--r--Help/guide/tutorial/Step3/tutorial.cxx3
3 files changed, 4 insertions, 27 deletions
diff --git a/Help/guide/tutorial/Step3/CMakeLists.txt b/Help/guide/tutorial/Step3/CMakeLists.txt
index baa0a44..966c38a 100644
--- a/Help/guide/tutorial/Step3/CMakeLists.txt
+++ b/Help/guide/tutorial/Step3/CMakeLists.txt
@@ -6,7 +6,7 @@ set(CMAKE_CXX_STANDARD 14)
# should we use our own math functions
option(USE_MYMATH "Use tutorial provided math implementation" ON)
-# the version number.
+# set the version number
set(Tutorial_VERSION_MAJOR 1)
set(Tutorial_VERSION_MINOR 0)
diff --git a/Help/guide/tutorial/Step3/directions.txt b/Help/guide/tutorial/Step3/directions.txt
deleted file mode 100644
index 54d0318..0000000
--- a/Help/guide/tutorial/Step3/directions.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-# Adding Usage Requirements for Library #
-
-Usage requirements allow for far better control over a library / executable's
-link and include line. While also giving more control over the transitive
-property of targets inside CMake. The primary commands that leverage usage
-requirements are:
-
- - target_compile_definitions
- - target_compile_options
- - target_include_directories
- - target_link_libraries
-
-First up is MathFunctions. We first state that anybody linking to MathFunctions
-needs to include the current source directory, while MathFunctions itself
-doesn't. So this can become an INTERFACE usage requirement.
-
-Remember INTERFACE means things that consumers require but the producer doesn't.
-
- target_include_directories(MathFunctions
- INTERFACE ${CMAKE_CURRENT_SOURCE_DIR})
-
-Now that we've specified usage requirements for MathFunctions we can safely remove
-our uses of the EXTRA_INCLUDES variable.
-
-Run cmake or cmake-gui to configure the project and then build it with your
-chosen build tool.
diff --git a/Help/guide/tutorial/Step3/tutorial.cxx b/Help/guide/tutorial/Step3/tutorial.cxx
index c2b89df..8156a9c 100644
--- a/Help/guide/tutorial/Step3/tutorial.cxx
+++ b/Help/guide/tutorial/Step3/tutorial.cxx
@@ -5,6 +5,7 @@
#include "TutorialConfig.h"
+// should we include the MathFunctions header?
#ifdef USE_MYMATH
# include "MathFunctions.h"
#endif
@@ -12,6 +13,7 @@
int main(int argc, char* argv[])
{
if (argc < 2) {
+ // report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl;
@@ -20,6 +22,7 @@ int main(int argc, char* argv[])
double inputValue = std::stod(argv[1]);
+ // which square root function should we use?
#ifdef USE_MYMATH
double outputValue = mysqrt(inputValue);
#else