Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Tutorial / Step3 / CMakeLists.txt
blob5481bce9cc86f376a99389c7e7564ff4cb3fbf51
1 project (Tutorial)
3 # The version number.
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
11 # to the source code
12 configure_file (
13   "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
14   "${PROJECT_BINARY_DIR}/TutorialConfig.h"
15   )
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?
22 if (USE_MYMATH)
23   include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions")
24   add_subdirectory (MathFunctions)
25   set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
26 endif (USE_MYMATH)
28 # add the executable
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" 
35   DESTINATION include)
38 # enable testing
39 enable_testing ()
41 # does the application run
42 add_test (TutorialRuns Tutorial 25)
44 # does it sqrt of 25
45 add_test (TutorialComp25 Tutorial 25)
46 set_tests_properties (TutorialComp25 
47   PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5"
48   )
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"
54   )
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"
60   )
62 # does the usage message work?
63 add_test (TutorialUsage Tutorial)
64 set_tests_properties (TutorialUsage
65   PROPERTIES 
66   PASS_REGULAR_EXPRESSION "Usage:.*number"
67   )