Update copyright header script to support CMake and Python files (#5067)
[cvc5.git] / cmake / FindJUnit.cmake
1 #####################
2 ## FindJUnit.cmake
3 ## Top contributors (to current version):
4 ## Mathias Preiner
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 JUnit
12 # JUnit_FOUND - system has JUnit lib
13 # JUnit_JAR - JUnit jar file
14 # JUnit_JAR_DEPS - JUnit jar dependencies
15
16 find_package(Java REQUIRED)
17 include(UseJava)
18 find_package(Hamcrest REQUIRED)
19
20 find_jar(JUnit_JAR NAMES junit junit4)
21
22 if(JUnit_JAR)
23 set(JUnit_JAR_DEPS ${Hamcrest_JAR})
24 # Determine version of JUnit
25 execute_process(
26 COMMAND ${Java_JAVA_EXECUTABLE} -cp ${JUnit_JAR} junit.runner.Version
27 OUTPUT_VARIABLE JUnit_VERSION
28 OUTPUT_STRIP_TRAILING_WHITESPACE)
29 endif()
30
31 include(FindPackageHandleStandardArgs)
32 find_package_handle_standard_args(JUnit
33 REQUIRED_VARS JUnit_JAR JUnit_JAR_DEPS
34 VERSION_VAR JUnit_VERSION)
35
36 mark_as_advanced(JUnit_JAR JUnit_JAR_DEPS)