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.
This commit is contained in:
Betsy McPhail
2019-07-09 13:21:40 -04:00
committed by Brad King
parent 1996e01578
commit 82332f81bb
30 changed files with 197 additions and 207 deletions

View File

@@ -1,3 +0,0 @@
project(Tutorial)
add_executable(Tutorial tutorial.cxx)

View File

@@ -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@

View File

@@ -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;