1 cmake_minimum_required (VERSION 2.6)
5 set (Tutorial_VERSION_MAJOR 1)
6 set (Tutorial_VERSION_MINOR 0)
8 # should we use our own math functions
9 option(USE_MYMATH "Use tutorial provided math implementation" ON)
11 # configure a header file to pass some of the CMake settings
14 "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
15 "${PROJECT_BINARY_DIR}/TutorialConfig.h"
18 # add the binary tree to the search path for include files
19 # so that we will find TutorialConfig.h
20 include_directories ("${PROJECT_BINARY_DIR}")
22 # add the MathFunctions library?
24 include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions")
25 add_subdirectory (MathFunctions)
26 set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
30 add_executable (Tutorial tutorial.cxx)
31 target_link_libraries (Tutorial ${EXTRA_LIBS})
33 # add the install targets
34 install (TARGETS Tutorial DESTINATION bin)
35 install (FILES "${PROJECT_BINARY_DIR}/TutorialConfig.h"
42 # does the application run
43 add_test (TutorialRuns Tutorial 25)
46 add_test (TutorialComp25 Tutorial 25)
47 set_tests_properties (TutorialComp25
48 PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5"
51 # does it handle negative numbers
52 add_test (TutorialNegative Tutorial -25)
53 set_tests_properties (TutorialNegative
54 PROPERTIES PASS_REGULAR_EXPRESSION "-25 is 0"
57 # does it handle small numbers
58 add_test (TutorialSmall Tutorial 0.0001)
59 set_tests_properties (TutorialSmall
60 PROPERTIES PASS_REGULAR_EXPRESSION "0.0001 is 0.01"
63 # does the usage message work?
64 add_test (TutorialUsage Tutorial)
65 set_tests_properties (TutorialUsage
67 PASS_REGULAR_EXPRESSION "Usage:.*number"