Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Tests / Tutorial / Step3 / CMakeLists.txt
blob0b05fd73737e7c91ec665c586d332500083894d9
1 cmake_minimum_required (VERSION 2.6)
2 project (Tutorial)
4 # The version number.
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
12 # to the source code
13 configure_file (
14   "${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
15   "${PROJECT_BINARY_DIR}/TutorialConfig.h"
16   )
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?
23 if (USE_MYMATH)
24   include_directories ("${PROJECT_SOURCE_DIR}/MathFunctions")
25   add_subdirectory (MathFunctions)
26   set (EXTRA_LIBS ${EXTRA_LIBS} MathFunctions)
27 endif (USE_MYMATH)
29 # add the executable
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" 
36   DESTINATION include)
39 # enable testing
40 enable_testing ()
42 # does the application run
43 add_test (TutorialRuns Tutorial 25)
45 # does it sqrt of 25
46 add_test (TutorialComp25 Tutorial 25)
47 set_tests_properties (TutorialComp25 
48   PROPERTIES PASS_REGULAR_EXPRESSION "25 is 5"
49   )
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"
55   )
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"
61   )
63 # does the usage message work?
64 add_test (TutorialUsage Tutorial)
65 set_tests_properties (TutorialUsage
66   PROPERTIES 
67   PASS_REGULAR_EXPRESSION "Usage:.*number"
68   )