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
7 # SQUISH_VERSION_MAJOR The major version of Squish found
8 # SQUISH_VERSION_MINOR The minor version of Squish found
9 # SQUISH_VERSION_PATCH The patch version of Squish found
11 # SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
12 # SQUISH_SERVER_EXECUTABLE The squishserver executable
13 # SQUISH_CLIENT_EXECUTABLE The squishrunner executable
15 # SQUISH_INSTALL_DIR_FOUND Was the install directory found?
16 # SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
17 # SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
19 # macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
23 # FIND_PACKAGE(Squish)
25 # SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
26 # ENDIF (SQUISH_FOUND)
29 SET(SQUISH_INSTALL_DIR_STRING "Directory containing the bin, doc, and lib directories for Squish; this should be the root of the installation directory.")
30 SET(SQUISH_SERVER_EXECUTABLE_STRING "The squishserver executable program.")
31 SET(SQUISH_CLIENT_EXECUTABLE_STRING "The squishclient executable program.")
33 # Search only if the location is not already known.
34 IF(NOT SQUISH_INSTALL_DIR)
35 # Get the system search path as a list.
37 STRING(REGEX MATCHALL "[^:]+" SQUISH_INSTALL_DIR_SEARCH1 "$ENV{PATH}")
39 STRING(REGEX REPLACE "\\\\" "/" SQUISH_INSTALL_DIR_SEARCH1 "$ENV{PATH}")
41 STRING(REGEX REPLACE "/;" ";" SQUISH_INSTALL_DIR_SEARCH2 ${SQUISH_INSTALL_DIR_SEARCH1})
43 # Construct a set of paths relative to the system search path.
44 SET(SQUISH_INSTALL_DIR_SEARCH "")
45 FOREACH(dir ${SQUISH_INSTALL_DIR_SEARCH2})
46 SET(SQUISH_INSTALL_DIR_SEARCH ${SQUISH_INSTALL_DIR_SEARCH} "${dir}/../lib/fltk")
49 # Look for an installation
50 FIND_PATH(SQUISH_INSTALL_DIR bin/squishrunner
51 # Look for an environment variable SQUISH_INSTALL_DIR.
52 $ENV{SQUISH_INSTALL_DIR}
54 # Look in places relative to the system executable search path.
55 ${SQUISH_INSTALL_DIR_SEARCH}
57 # Look in standard UNIX install locations.
60 DOC "The ${SQUISH_INSTALL_DIR_STRING}"
62 ENDIF(NOT SQUISH_INSTALL_DIR)
64 # search for the executables
65 IF(SQUISH_INSTALL_DIR)
66 SET(SQUISH_INSTALL_DIR_FOUND 1)
68 # find the client program
69 IF(NOT SQUISH_CLIENT_EXECUTABLE)
70 FIND_PROGRAM(SQUISH_CLIENT_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishrunner DOC "The ${SQUISH_CLIENT_EXECUTABLE_STRING}")
71 ENDIF(NOT SQUISH_CLIENT_EXECUTABLE)
73 # find the server program
74 IF(NOT SQUISH_SERVER_EXECUTABLE)
75 FIND_PROGRAM(SQUISH_SERVER_EXECUTABLE ${SQUISH_INSTALL_DIR}/bin/squishserver DOC "The ${SQUISH_SERVER_EXECUTABLE_STRING}")
76 ENDIF(NOT SQUISH_SERVER_EXECUTABLE)
78 ELSE(SQUISH_INSTALL_DIR)
79 SET(SQUISH_INSTALL_DIR_FOUND 0)
80 ENDIF(SQUISH_INSTALL_DIR)
82 # record if executables are set
83 IF(SQUISH_CLIENT_EXECUTABLE)
84 SET(SQUISH_CLIENT_EXECUTABLE_FOUND 1)
85 ELSE(SQUISH_CLIENT_EXECUTABLE)
86 SET(SQUISH_CLIENT_EXECUTABLE_FOUND 0)
87 ENDIF(SQUISH_CLIENT_EXECUTABLE)
89 IF(SQUISH_SERVER_EXECUTABLE)
90 SET(SQUISH_SERVER_EXECUTABLE_FOUND 1)
91 ELSE(SQUISH_SERVER_EXECUTABLE)
92 SET(SQUISH_SERVER_EXECUTABLE_FOUND 0)
93 ENDIF(SQUISH_SERVER_EXECUTABLE)
95 # record if Squish was found
97 FOREACH(var SQUISH_INSTALL_DIR_FOUND SQUISH_CLIENT_EXECUTABLE_FOUND SQUISH_SERVER_EXECUTABLE_FOUND)
103 MACRO(SQUISH_ADD_TEST testName testAUT testCase envVars testWraper)
105 ${CMAKE_COMMAND} -V -VV
106 "-Dsquish_aut:STRING=${testAUT}"
107 "-Dsquish_server_executable:STRING=${SQUISH_SERVER_EXECUTABLE}"
108 "-Dsquish_client_executable:STRING=${SQUISH_CLIENT_EXECUTABLE}"
109 "-Dsquish_libqtdir:STRING=${QT_LIBRARY_DIR}"
110 "-Dsquish_test_case:STRING=${testCase}"
111 "-Dsquish_env_vars:STRING=${envVars}"
112 "-Dsquish_wrapper:STRING=${testWraper}"
113 -P "${CMAKE_ROOT}/Modules/SquishTestScript.cmake"
115 SET_TESTS_PROPERTIES(${testName}
116 PROPERTIES FAIL_REGULAR_EXPRESSION "FAILED;ERROR;FATAL"
118 ENDMACRO(SQUISH_ADD_TEST)