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