File: FindCxxTest.cmake

package info (click to toggle)
cvc4 1.8-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 69,876 kB
  • sloc: cpp: 274,686; sh: 5,833; python: 1,893; java: 929; lisp: 763; ansic: 275; perl: 214; makefile: 22; awk: 2
file content (50 lines) | stat: -rw-r--r-- 1,954 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Find CxxTest
# CxxTest_FOUND - system has CxxTest lib
# CxxTest_INCLUDE_DIR - the CxxTest include directory
# CxxTest_TESTGEN_EXECUTABLE - CxxTest excecutable
# CxxTest_TESTGEN_INTERPRETER - Python/Perl interpreter for running executable

find_package(PythonInterp QUIET)
find_package(Perl QUIET)

find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h
          PATHS ${CxxTest_HOME}
          NO_DEFAULT_PATH)
find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE
             NAMES cxxtestgen cxxtestgen.py
             PATHS ${CxxTest_HOME}/bin
             NO_DEFAULT_PATH)
find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
             PATHS ${CxxTest_HOME}/bin
             NO_DEFAULT_PATH)

if(NOT CxxTest_HOME)
  find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h)
  find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE NAMES cxxtestgen.py)
  find_program(CxxTest_SHEBANG_TESTGEN_EXECUTABLE NAMES cxxtestgen)
  find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl)
endif()


if(CxxTest_SHEBANG_TESTGEN_EXECUTABLE)
  set(CxxTest_USE_SHEBANG ON)
  set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_SHEBANG_TESTGEN_EXECUTABLE})
elseif(PYTHONINTERP_FOUND AND CxxTest_PYTHON_TESTGEN_EXECUTABLE)
  set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PYTHON_TESTGEN_EXECUTABLE})
  set(CxxTest_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
elseif(PERL_FOUND AND CxxTest_PERL_TESTGEN_EXECUTABLE)
  set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PERL_TESTGEN_EXECUTABLE})
  set(CxxTest_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
elseif(NOT PYTHONINTERP_FOUND AND NOT PERL_FOUND AND CxxTest_FIND_REQUIRED)
  message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest.")
endif()

if(NOT DEFINED CxxTest_TESTGEN_ARGS)
  set(CxxTest_TESTGEN_ARGS --error-printer)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
  CxxTest DEFAULT_MSG CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)

mark_as_advanced(CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)