File: FindJUnit.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 (26 lines) | stat: -rw-r--r-- 690 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
# Find JUnit
# JUnit_FOUND - system has JUnit lib
# JUnit_JAR - JUnit jar file
# JUnit_JAR_DEPS - JUnit jar dependencies

find_package(Java REQUIRED)
include(UseJava)
find_package(Hamcrest REQUIRED)

find_jar(JUnit_JAR NAMES junit junit4)

if(JUnit_JAR)
  set(JUnit_JAR_DEPS ${Hamcrest_JAR})
  # Determine version of JUnit
  execute_process(
    COMMAND ${Java_JAVA_EXECUTABLE} -cp ${JUnit_JAR} junit.runner.Version
    OUTPUT_VARIABLE JUnit_VERSION
    OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(JUnit
  REQUIRED_VARS JUnit_JAR JUnit_JAR_DEPS
  VERSION_VAR JUnit_VERSION)

mark_as_advanced(JUnit_JAR JUnit_JAR_DEPS)