3 # This module can be used to find Squish (currently support is aimed at version 3).
5 # ---- Variables and Macros
6 # SQUISH_FOUND If false, don't try to use Squish
8 # SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
9 # SQUISH_SERVER_EXECUTABLE The squishserver executable
10 # SQUISH_CLIENT_EXECUTABLE The squishrunner executable
12 # SQUISH_INSTALL_DIR_FOUND Was the install directory found?
13 # SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
14 # SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
16 # macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
20 # find_package(Squish)
22 # SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
26 #=============================================================================
27 # Copyright 2008-2009 Kitware, Inc.
29 # Distributed under the OSI-approved BSD License (the "License");
30 # see accompanying file Copyright.txt for details.
32 # This software is distributed WITHOUT ANY WARRANTY; without even the
33 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
34 # See the License for more information.
35 #=============================================================================
36 # (To distribute this file outside of CMake, substitute the full
37 # License text for the above reference.)
39 set(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
40 set(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
41 set(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.")
43 # Search only if the location is not already known.
44 if(NOT SQUISH_INSTALL_DIR)
45 # Get the system search path as a list.
46 file(TO_CMAKE_PATH "$ENV{PATH}" SQUISH_INSTALL_DIR_SEARCH2)
48 # Construct a set of paths relative to the system search path.
49 set(SQUISH_INSTALL_DIR_SEARCH "")
50 foreach(dir ${SQUISH_INSTALL_DIR_SEARCH2})
51 set(SQUISH_INSTALL_DIR_SEARCH ${SQUISH_INSTALL_DIR_SEARCH} "${dir}/../lib/fltk")
53 string(REPLACE "//" "/" SQUISH_INSTALL_DIR_SEARCH "${SQUISH_INSTALL_DIR_SEARCH}")
55 # Look for an installation
56 find_path(SQUISH_INSTALL_DIR bin/squishrunner
58 # Look for an environment variable SQUISH_INSTALL_DIR.
59 ENV SQUISH_INSTALL_DIR
61 # Look in places relative to the system executable search path.
62 ${SQUISH_INSTALL_DIR_SEARCH}
64 # Look in standard UNIX install locations.
67 DOC "The ${SQUISH_INSTALL_DIR_STRING}"
71 # search for the executables
72 if(SQUISH_INSTALL_DIR)
73 set(SQUISH_INSTALL_DIR_FOUND 1)
75 # find the client program
76 if(NOT SQUISH_CLIENT_EXECUTABLE)
77 find_program(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
80 # find the server program
81 if(NOT SQUISH_SERVER_EXECUTABLE)
82 find_program(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
86 set(SQUISH_INSTALL_DIR_FOUND 0)
89 # record if executables are set
90 if(SQUISH_CLIENT_EXECUTABLE)
91 set(SQUISH_CLIENT_EXECUTABLE_FOUND 1)
93 set(SQUISH_CLIENT_EXECUTABLE_FOUND 0)
96 if(SQUISH_SERVER_EXECUTABLE)
97 set(SQUISH_SERVER_EXECUTABLE_FOUND 1)
99 set(SQUISH_SERVER_EXECUTABLE_FOUND 0)
102 # record if Squish was found
104 foreach(var SQUISH_INSTALL_DIR_FOUND SQUISH_CLIENT_EXECUTABLE_FOUND SQUISH_SERVER_EXECUTABLE_FOUND)
110 macro(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
112 ${CMAKE_COMMAND} -V -VV
113 "-Dsquish_aut:STRING=${testAUT}"
114 "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
115 "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
116 "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
117 "-Dsquish_test_case:STRING=${testCase}"
118 "-Dsquish_env_vars:STRING=${envVars}"
119 "-Dsquish_wrapper:STRING=${testWraper}"
120 -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake"
122 set_tests_properties(${testName}
123 PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL"