diff options
Diffstat (limited to 'Help/guide/tutorial/Complete')
-rw-r--r-- | Help/guide/tutorial/Complete/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Help/guide/tutorial/Complete/tutorial.cxx | 5 |
2 files changed, 7 insertions, 11 deletions
diff --git a/Help/guide/tutorial/Complete/CMakeLists.txt b/Help/guide/tutorial/Complete/CMakeLists.txt index 4541392..26073bd 100644 --- a/Help/guide/tutorial/Complete/CMakeLists.txt +++ b/Help/guide/tutorial/Complete/CMakeLists.txt @@ -1,5 +1,7 @@ cmake_minimum_required(VERSION 3.15) -project(Tutorial) + +# set the project name and version +project(Tutorial VERSION 1.0) add_library(tutorial_compiler_flags INTERFACE) target_compile_features(tutorial_compiler_flags INTERFACE cxx_std_11) @@ -13,10 +15,6 @@ target_compile_options(tutorial_compiler_flags INTERFACE "$<${msvc_cxx}:$<BUILD_INTERFACE:-W3>>" ) -# set the version number -set(Tutorial_VERSION_MAJOR 1) -set(Tutorial_VERSION_MINOR 0) - # control where the static and shared libraries are built so that on windows # we don't need to tinker with the path to run the executable set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") @@ -32,10 +30,7 @@ elseif(UNIX) endif() # configure a header file to pass the version number only -configure_file( - "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in" - "${PROJECT_BINARY_DIR}/TutorialConfig.h" - ) +configure_file(TutorialConfig.h.in TutorialConfig.h) # add the MathFunctions library add_subdirectory(MathFunctions) diff --git a/Help/guide/tutorial/Complete/tutorial.cxx b/Help/guide/tutorial/Complete/tutorial.cxx index 4451cbd..586d183 100644 --- a/Help/guide/tutorial/Complete/tutorial.cxx +++ b/Help/guide/tutorial/Complete/tutorial.cxx @@ -15,10 +15,11 @@ 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]); + // calculate square root const double outputValue = mathfunctions::sqrt(inputValue); - std::cout << "The square root of " << inputValue << " is " << outputValue << std::endl; return 0; |