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/tutorial.cxx | |
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/tutorial.cxx')
-rw-r--r-- | Help/guide/tutorial/Step1/tutorial.cxx | 6 |
1 files changed, 4 insertions, 2 deletions
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; |