Imported Upstream version 2.8.10.2
[platform/upstream/cmake.git] / Modules / Dart.cmake
1 # - Configure a project for testing with CTest or old Dart Tcl Client
2 # This file is the backwards-compatibility version of the CTest module.
3 # It supports using the old Dart 1 Tcl client for driving dashboard
4 # submissions as well as testing with CTest.  This module should be included
5 # in the CMakeLists.txt file at the top of a project.  Typical usage:
6 #  include(Dart)
7 #  if(BUILD_TESTING)
8 #    # ... testing related CMake code ...
9 #  endif()
10 # The BUILD_TESTING option is created by the Dart module to determine
11 # whether testing support should be enabled.  The default is ON.
12
13 # This file configures a project to use the Dart testing/dashboard process.
14 # It is broken into 3 sections.
15 #
16 #  Section #1: Locate programs on the client and determine site and build name
17 #  Section #2: Configure or copy Tcl scripts from the source tree to build tree
18 #  Section #3: Custom targets for performing dashboard builds.
19 #
20 #
21
22 #=============================================================================
23 # Copyright 2001-2009 Kitware, Inc.
24 #
25 # Distributed under the OSI-approved BSD License (the "License");
26 # see accompanying file Copyright.txt for details.
27 #
28 # This software is distributed WITHOUT ANY WARRANTY; without even the
29 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
30 # See the License for more information.
31 #=============================================================================
32 # (To distribute this file outside of CMake, substitute the full
33 #  License text for the above reference.)
34
35 option(BUILD_TESTING "Build the testing tree." ON)
36
37 if(BUILD_TESTING)
38   find_package(Dart QUIET)
39
40   #
41   # Section #1:
42   #
43   # CMake commands that will not vary from project to project. Locates programs
44   # on the client and configure site name and build name.
45   #
46
47   set(RUN_FROM_DART 1)
48   include(CTest)
49   set(RUN_FROM_DART)
50
51   find_program(COMPRESSIONCOMMAND NAMES gzip compress zip
52     DOC "Path to program used to compress files for transfer to the dart server")
53   find_program(GUNZIPCOMMAND gunzip DOC "Path to gunzip executable")
54   find_program(JAVACOMMAND java DOC "Path to java command, used by the Dart server to create html.")
55   option(DART_VERBOSE_BUILD "Show the actual output of the build, or if off show a . for each 1024 bytes."
56     OFF)
57   option(DART_BUILD_ERROR_REPORT_LIMIT "Limit of reported errors, -1 reports all." -1 )
58   option(DART_BUILD_WARNING_REPORT_LIMIT "Limit of reported warnings, -1 reports all." -1 )
59
60   set(VERBOSE_BUILD ${DART_VERBOSE_BUILD})
61   set(BUILD_ERROR_REPORT_LIMIT ${DART_BUILD_ERROR_REPORT_LIMIT})
62   set(BUILD_WARNING_REPORT_LIMIT ${DART_BUILD_WARNING_REPORT_LIMIT})
63   set (DELIVER_CONTINUOUS_EMAIL "Off" CACHE BOOL "Should Dart server send email when build errors are found in Continuous builds?")
64
65   mark_as_advanced(
66     COMPRESSIONCOMMAND
67     DART_BUILD_ERROR_REPORT_LIMIT
68     DART_BUILD_WARNING_REPORT_LIMIT
69     DART_TESTING_TIMEOUT
70     DART_VERBOSE_BUILD
71     DELIVER_CONTINUOUS_EMAIL
72     GUNZIPCOMMAND
73     JAVACOMMAND
74     )
75
76   set(HAVE_DART)
77   if(EXISTS "${DART_ROOT}/Source/Client/Dart.conf.in")
78     set(HAVE_DART 1)
79   endif()
80
81   #
82   # Section #2:
83   #
84   # Make necessary directories and configure testing scripts
85   #
86   # find a tcl shell command
87   if(HAVE_DART)
88     find_package(Tclsh)
89   endif()
90
91
92   if (HAVE_DART)
93     # make directories in the binary tree
94     file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Dashboard"
95       "${PROJECT_BINARY_DIR}/Testing/HTML/TestingResults/Sites/${SITE}/${BUILDNAME}")
96
97     # configure files
98     configure_file(
99       "${DART_ROOT}/Source/Client/Dart.conf.in"
100       "${PROJECT_BINARY_DIR}/DartConfiguration.tcl" )
101
102     #
103     # Section 3:
104     #
105     # Custom targets to perform dashboard builds and submissions.
106     # These should NOT need to be modified from project to project.
107     #
108
109     # add testing targets
110     set(DART_EXPERIMENTAL_NAME Experimental)
111     if(DART_EXPERIMENTAL_USE_PROJECT_NAME)
112       set(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}")
113     endif()
114   endif ()
115
116   set(RUN_FROM_CTEST_OR_DART 1)
117   include(CTestTargets)
118   set(RUN_FROM_CTEST_OR_DART)
119 endif()
120
121 #
122 # End of Dart.cmake
123 #
124