summaryrefslogtreecommitdiffstats
path: root/Tests/Tutorial/Step7/tutorial.cxx
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2007-11-08 15:38:26 (GMT)
committerDavid Cole <david.cole@kitware.com>2007-11-08 15:38:26 (GMT)
commit4e752dee910d3901a438d97aedf49357a8cb5628 (patch)
tree3393d691a3e67c13610b9252e2f967d4433f95a6 /Tests/Tutorial/Step7/tutorial.cxx
parente615e1416cc5139082593c07db99ead11c6d5d46 (diff)
downloadCMake-4e752dee910d3901a438d97aedf49357a8cb5628.zip
CMake-4e752dee910d3901a438d97aedf49357a8cb5628.tar.gz
CMake-4e752dee910d3901a438d97aedf49357a8cb5628.tar.bz2
ENH: Add new Tutorial steps. Diff between Step5 and Step6 shows how to add a cpack driven installer to your project. Diff between Step6 and Step7 shows how to add ctest dashboard scripting capability.
Diffstat (limited to 'Tests/Tutorial/Step7/tutorial.cxx')
-rw-r--r--Tests/Tutorial/Step7/tutorial.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/Tests/Tutorial/Step7/tutorial.cxx b/Tests/Tutorial/Step7/tutorial.cxx
new file mode 100644
index 0000000..82b416f
--- /dev/null
+++ b/Tests/Tutorial/Step7/tutorial.cxx
@@ -0,0 +1,34 @@
+// A simple program that computes the square root of a number
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "TutorialConfig.h"
+
+#ifdef USE_MYMATH
+#include "MathFunctions.h"
+#endif
+
+int main (int argc, char *argv[])
+{
+ if (argc < 2)
+ {
+ fprintf(stdout,"%s Version %d.%d\n",
+ argv[0],
+ Tutorial_VERSION_MAJOR,
+ Tutorial_VERSION_MINOR);
+ fprintf(stdout,"Usage: %s number\n",argv[0]);
+ return 1;
+ }
+
+ double inputValue = atof(argv[1]);
+
+#ifdef USE_MYMATH
+ double outputValue = mysqrt(inputValue);
+#else
+ double outputValue = sqrt(inputValue);
+#endif
+
+ fprintf(stdout,"The square root of %g is %g\n",
+ inputValue, outputValue);
+ return 0;
+}