Eliminate equality query dependence on quantifiers engine (#5831)
[cvc5.git] / cmake / FindCxxTest.cmake
1 #####################
2 ## FindCxxTest.cmake
3 ## Top contributors (to current version):
4 ## Mathias Preiner, Alex Ozdemir, Andrew Reynolds
5 ## This file is part of the CVC4 project.
6 ## Copyright (c) 2009-2020 by the authors listed in the file AUTHORS
7 ## in the top-level source directory and their institutional affiliations.
8 ## All rights reserved. See the file COPYING in the top-level source
9 ## directory for licensing information.
10 ##
11 # Find CxxTest
12 # CxxTest_FOUND - system has CxxTest lib
13 # CxxTest_INCLUDE_DIR - the CxxTest include directory
14 # CxxTest_TESTGEN_EXECUTABLE - CxxTest excecutable
15 # CxxTest_TESTGEN_INTERPRETER - Python/Perl interpreter for running executable
16
17 find_package(PythonInterp QUIET)
18 find_package(Perl QUIET)
19
20 find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h
21 PATHS ${CxxTest_HOME}
22 NO_DEFAULT_PATH)
23 find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE
24 NAMES cxxtestgen cxxtestgen.py
25 PATHS ${CxxTest_HOME}/bin
26 NO_DEFAULT_PATH)
27 find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl
28 PATHS ${CxxTest_HOME}/bin
29 NO_DEFAULT_PATH)
30
31 if(NOT CxxTest_HOME)
32 find_path(CxxTest_INCLUDE_DIR cxxtest/TestSuite.h)
33 find_program(CxxTest_PYTHON_TESTGEN_EXECUTABLE NAMES cxxtestgen.py)
34 find_program(CxxTest_SHEBANG_TESTGEN_EXECUTABLE NAMES cxxtestgen)
35 find_program(CxxTest_PERL_TESTGEN_EXECUTABLE cxxtestgen.pl)
36 endif()
37
38
39 if(CxxTest_SHEBANG_TESTGEN_EXECUTABLE)
40 set(CxxTest_USE_SHEBANG ON)
41 set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_SHEBANG_TESTGEN_EXECUTABLE})
42 elseif(PYTHONINTERP_FOUND AND CxxTest_PYTHON_TESTGEN_EXECUTABLE)
43 set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PYTHON_TESTGEN_EXECUTABLE})
44 set(CxxTest_TESTGEN_INTERPRETER ${PYTHON_EXECUTABLE})
45 elseif(PERL_FOUND AND CxxTest_PERL_TESTGEN_EXECUTABLE)
46 set(CxxTest_TESTGEN_EXECUTABLE ${CxxTest_PERL_TESTGEN_EXECUTABLE})
47 set(CxxTest_TESTGEN_INTERPRETER ${PERL_EXECUTABLE})
48 elseif(NOT PYTHONINTERP_FOUND AND NOT PERL_FOUND AND CxxTest_FIND_REQUIRED)
49 message(FATAL_ERROR "Neither Python nor Perl found, cannot use CxxTest.")
50 endif()
51
52 if(NOT DEFINED CxxTest_TESTGEN_ARGS)
53 set(CxxTest_TESTGEN_ARGS --error-printer)
54 endif()
55
56 include(FindPackageHandleStandardArgs)
57 find_package_handle_standard_args(
58 CxxTest DEFAULT_MSG CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)
59
60 mark_as_advanced(CxxTest_INCLUDE_DIR CxxTest_TESTGEN_EXECUTABLE)