diff options
author | Betsy McPhail <betsy.mcphail@kitware.com> | 2019-07-09 17:21:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-08-19 15:48:58 (GMT) |
commit | 82332f81bbb0609bf521d29c36b3ecf1566be892 (patch) | |
tree | 5ec58581dcc9e85f34c57efd013e7932e21d889d /Help/guide/tutorial/Step1 | |
parent | 1996e0157826903f27f73825a01f83d53dc8fba4 (diff) | |
download | CMake-82332f81bbb0609bf521d29c36b3ecf1566be892.zip CMake-82332f81bbb0609bf521d29c36b3ecf1566be892.tar.gz CMake-82332f81bbb0609bf521d29c36b3ecf1566be892.tar.bz2 |
Tutorial: Improve Step 1
* Update minimum required version to 3.10
* Use VERSION argument to project command rather than separate variables
* Replace `endif(USE_MYMATH)` with more modern `endif()`
* Simplify the call to 'configure_file()'
* Add comments to tutorial.cxx to use as anchors in documentation
* Remove CMakeLists and TutorialConfig.h.in files that users should
create. Consequently, remove Step1 from CMake tests.
Diffstat (limited to 'Help/guide/tutorial/Step1')
-rw-r--r-- | Help/guide/tutorial/Step1/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Help/guide/tutorial/Step1/TutorialConfig.h.in | 3 | ||||
-rw-r--r-- | Help/guide/tutorial/Step1/tutorial.cxx | 6 |
3 files changed, 4 insertions, 8 deletions
diff --git a/Help/guide/tutorial/Step1/CMakeLists.txt b/Help/guide/tutorial/Step1/CMakeLists.txt deleted file mode 100644 index 141f0c2..0000000 --- a/Help/guide/tutorial/Step1/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -project(Tutorial) - -add_executable(Tutorial tutorial.cxx) diff --git a/Help/guide/tutorial/Step1/TutorialConfig.h.in b/Help/guide/tutorial/Step1/TutorialConfig.h.in deleted file mode 100644 index 7e4d7fa..0000000 --- a/Help/guide/tutorial/Step1/TutorialConfig.h.in +++ /dev/null @@ -1,3 +0,0 @@ -// the configured options and settings for Tutorial -#define Tutorial_VERSION_MAJOR @Tutorial_VERSION_MAJOR@ -#define Tutorial_VERSION_MINOR @Tutorial_VERSION_MINOR@ diff --git a/Help/guide/tutorial/Step1/tutorial.cxx b/Help/guide/tutorial/Step1/tutorial.cxx index f8dd0c6..08323bf 100644 --- a/Help/guide/tutorial/Step1/tutorial.cxx +++ b/Help/guide/tutorial/Step1/tutorial.cxx @@ -11,9 +11,11 @@ int main(int argc, char* argv[]) return 1; } - double inputValue = atof(argv[1]); + // convert input to double + const double inputValue = atof(argv[1]); - double outputValue = sqrt(inputValue); + // calculate square root + const double outputValue = sqrt(inputValue); std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; return 0; |