mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-16 14:08:35 +08:00
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:
@@ -20,13 +20,14 @@ int main(int argc, char* argv[])
|
||||
return 1;
|
||||
}
|
||||
|
||||
double inputValue = std::stod(argv[1]);
|
||||
// convert input to double
|
||||
const double inputValue = std::stod(argv[1]);
|
||||
|
||||
// which square root function should we use?
|
||||
#ifdef USE_MYMATH
|
||||
double outputValue = mysqrt(inputValue);
|
||||
const double outputValue = mysqrt(inputValue);
|
||||
#else
|
||||
double outputValue = sqrt(inputValue);
|
||||
const double outputValue = sqrt(inputValue);
|
||||
#endif
|
||||
|
||||
std::cout << "The square root of " << inputValue << " is " << outputValue
|
||||
|
Reference in New Issue
Block a user