summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authormudathirmahgoub <mudathirmahgoub@gmail.com>2021-05-18 01:18:23 -0500
committerGitHub <noreply@github.com>2021-05-18 06:18:23 +0000
commitc781d274fbaf6f4b3e419140c5834511d6b7c7a0 (patch)
tree66b2a214b02b2a12f988b8b83a9463ee1b9b5a43 /cmake
parent59d935b0210fe20cdddf5de2be91bb26a66d05fb (diff)
Add Solver.java to the Java API (#6196)
PR changes: Add Solver.java and relation JNI c files Update FindJUnit to download JUnit5 Add Java unit tests
Diffstat (limited to 'cmake')
-rw-r--r--cmake/FindJUnit.cmake62
1 files changed, 43 insertions, 19 deletions
diff --git a/cmake/FindJUnit.cmake b/cmake/FindJUnit.cmake
index caa2c3eb9..1532042a4 100644
--- a/cmake/FindJUnit.cmake
+++ b/cmake/FindJUnit.cmake
@@ -1,6 +1,6 @@
###############################################################################
# Top contributors (to current version):
-# Mathias Preiner
+# Mathias Preiner, Mudathir Mohamed
#
# This file is part of the cvc5 project.
#
@@ -11,29 +11,53 @@
# #############################################################################
#
# Find JUnit
-# JUnit_FOUND - system has JUnit lib
-# JUnit_JAR - JUnit jar file
-# JUnit_JAR_DEPS - JUnit jar dependencies
+# JUnit_FOUND - should be true for testing
+# JUnit_JAR - absolute path to JUnit5 jar file
##
-find_package(Java REQUIRED)
-include(UseJava)
-find_package(Hamcrest REQUIRED)
+include(deps-helper)
-find_jar(JUnit_JAR NAMES junit junit4)
+find_jar(JUnit_JAR junit-platform-console-standalone
+ PATHS
+ ${DEPS_BASE}/share/java
+ $ENV{PATH} $ENV{HOME} $ENV{CLASSPATH} $ENV{JUNIT_HOME}
+)
+set(JUnit_FOUND_SYSTEM FALSE)
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)
+ set(JUnit_FOUND_SYSTEM TRUE)
endif()
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(JUnit
- REQUIRED_VARS JUnit_JAR JUnit_JAR_DEPS
- VERSION_VAR JUnit_VERSION)
+if(NOT JUnit_FOUND_SYSTEM)
+ check_auto_download("JUnit" "")
+ set(JUNIT_VERSION 1.7.1)
+ include(ExternalProject)
-mark_as_advanced(JUnit_JAR JUnit_JAR_DEPS)
+ # Download junit generator jar
+ ExternalProject_Add(
+ JUnit-EP-jar
+ PREFIX ${DEPS_PREFIX}
+ URL https://repo1.maven.org/maven2/org/junit/platform/junit-platform-console-standalone/${JUNIT_VERSION}/junit-platform-console-standalone-${JUNIT_VERSION}.jar
+ URL_HASH SHA1=99245bde65d028a8b8ff604be26e929ab6ff2e58
+ DOWNLOAD_NO_EXTRACT ON
+ CONFIGURE_COMMAND ""
+ BUILD_COMMAND ""
+ INSTALL_COMMAND ${CMAKE_COMMAND} -E copy
+ <SOURCE_DIR>/../junit-platform-console-standalone-${JUNIT_VERSION}.jar
+ <INSTALL_DIR>/share/java/junit-platform-console-standalone-${JUNIT_VERSION}.jar
+ BUILD_BYPRODUCTS <INSTALL_DIR>/share/java/junit-platform-console-standalone-${JUNIT_VERSION}.jar
+ )
+
+ set(JUnit_JAR "${DEPS_BASE}/share/java/junit-platform-console-standalone-${JUNIT_VERSION}.jar")
+endif()
+
+set(JUnit_FOUND TRUE)
+
+mark_as_advanced(JUnit_JAR)
+mark_as_advanced(JUnit_FOUND)
+
+if(JUnit_FOUND_SYSTEM)
+ message(STATUS "Found JUnit: ${JUnit_JAR}")
+else()
+ message(STATUS "Downloading JUnit: ${JUnit_JAR}")
+endif() \ No newline at end of file
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback