4 set (Tutorial_VERSION_MAJOR 1)
5 set (Tutorial_VERSION_MINOR 0)
7 # should we use our own math functions
8 option(USE_MYMATH "Use tutorial provided math implementation" ON)
10 # configure a header file to pass some of the CMake settings
13 "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
14 "${PROJECT_BINARY_DIR}/TutorialConfig.h"
17 # add the binary tree to the search path for include files
18 # so that we will find TutorialConfig.h
19 include_directories ("${PROJECT_BINARY_DIR}")
21 # add the MathFunctions library?
23 include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions")
24 add_subdirectory (MathFunctions)
25 set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
29 add_executable (Tutorial tutorial.cxx)
30 target_link_libraries (Tutorial ${EXTRA_LIBS})
32 # add the install targets
33 install (TARGETS Tutorial DESTINATION bin)
34 install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h"
41 # does the application run
42 add_test (TutorialRuns Tutorial 25)
45 add_test (TutorialComp25 Tutorial 25)
46 set_tests_properties (TutorialComp25
47 PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5"
50 # does it handle negative numbers
51 add_test (TutorialNegative Tutorial -25)
52 set_tests_properties (TutorialNegative
53 PROPERTIES PASS_REGULAR_EXPRESSION "-25 is 0"
56 # does it handle small numbers
57 add_test (TutorialSmall Tutorial 0.0001)
58 set_tests_properties (TutorialSmall
59 PROPERTIES PASS_REGULAR_EXPRESSION "0.0001 is 0.01"
62 # does the usage message work?
63 add_test (TutorialUsage Tutorial)
64 set_tests_properties (TutorialUsage
66 PASS_REGULAR_EXPRESSION "Usage:.*number"