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 | 6f6a32a0f601688da24e1737509a0b6e1ed4f63f (patch) | |
tree | a8a6f89b0a8126172337f543ebaca43d8a0469c2 /Help/guide/tutorial/Step9 | |
parent | 6a35d630dce6e9da6115cc4acb3393ce62a017ad (diff) | |
download | CMake-6f6a32a0f601688da24e1737509a0b6e1ed4f63f.zip CMake-6f6a32a0f601688da24e1737509a0b6e1ed4f63f.tar.gz CMake-6f6a32a0f601688da24e1737509a0b6e1ed4f63f.tar.bz2 |
Tutorial: Improve Step 9
* Move USE_MYMATH from configured header to target_compile_definitions
Diffstat (limited to 'Help/guide/tutorial/Step9')
-rw-r--r-- | Help/guide/tutorial/Step9/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Help/guide/tutorial/Step9/TutorialConfig.h.in | 3 | ||||
-rw-r--r-- | Help/guide/tutorial/Step9/tutorial.cxx | 1 |
4 files changed, 4 insertions, 7 deletions
diff --git a/Help/guide/tutorial/Step9/CMakeLists.txt b/Help/guide/tutorial/Step9/CMakeLists.txt index f437053..d5f1cc8 100644 --- a/Help/guide/tutorial/Step9/CMakeLists.txt +++ b/Help/guide/tutorial/Step9/CMakeLists.txt @@ -10,7 +10,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED True) # should we use our own math functions option(USE_MYMATH "Use tutorial provided math implementation" ON) -# configure a header file to pass the version number only +# configure a header file to pass some of the CMake settings +# to the source code configure_file(TutorialConfig.h.in TutorialConfig.h) # add the MathFunctions library diff --git a/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt b/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt index b40b464..50f0701 100644 --- a/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt +++ b/Help/guide/tutorial/Step9/MathFunctions/CMakeLists.txt @@ -22,10 +22,6 @@ target_include_directories(MathFunctions PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ) -# use compile definitions to state if we have enabled USE_MYMATH -# and that anything that links to use will get this define -target_compile_definitions(MathFunctions INTERFACE "USE_MYMATH") - # install rules install(TARGETS MathFunctions DESTINATION lib) install(FILES MathFunctions.h DESTINATION include) diff --git a/Help/guide/tutorial/Step9/TutorialConfig.h.in b/Help/guide/tutorial/Step9/TutorialConfig.h.in index 8cd2fc9..e23f521 100644 --- a/Help/guide/tutorial/Step9/TutorialConfig.h.in +++ b/Help/guide/tutorial/Step9/TutorialConfig.h.in @@ -1,3 +1,4 @@ -// the configured version number +// the configured options and settings for Tutorial #define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ #define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ +#cmakedefine USE_MYMATH diff --git a/Help/guide/tutorial/Step9/tutorial.cxx b/Help/guide/tutorial/Step9/tutorial.cxx index 779fbca..b3c6a4f 100644 --- a/Help/guide/tutorial/Step9/tutorial.cxx +++ b/Help/guide/tutorial/Step9/tutorial.cxx @@ -1,7 +1,6 @@ // A simple program that computes the square root of a number #include <cmath> #include <iostream> -#include <sstream> #include <string> #include "TutorialConfig.h" |