From 8e1eac35d265eacfbeb5f16be61e5d4caf45d1af Mon Sep 17 00:00:00 2001 From: Andres Noetzli Date: Mon, 24 May 2021 20:21:16 -0700 Subject: [PATCH] [Unit tests] Fix path of Java bindings (#6616) Currently, when configuring cvc5 with Java bindings, CMake complains about `get_filename_component(CVC5_JNI_PATH ${CVC5_JAR_PATH} DIRECTORY)` not using the correct number of arguments in the Java unit tests. The issue is that `${CVC5_JAR_PATH}` is empty. The value of `${CVC5_JAR_PATH}` was computed in the Java API bindings but then not shared with the rest of the build system. Because `${CVC5_JAR_PATH}` is not used anywhere else, this commit moves the computation of `${CVC5_JAR_PATH}` to the unit tests. The commit also ensures that the API subdirectories are processed before the test subdirectories. --- CMakeLists.txt | 3 ++- src/api/java/CMakeLists.txt | 2 -- test/unit/api/java/CMakeLists.txt | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1c6ad1604..d7512e874 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -503,7 +503,6 @@ endif() # Add subdirectories add_subdirectory(src) -add_subdirectory(test) if(BUILD_BINDINGS_PYTHON) set(BUILD_BINDINGS_PYTHON_VERSION ${PYTHON_VERSION_MAJOR}) @@ -519,6 +518,8 @@ if(BUILD_DOCS) add_subdirectory(docs) endif() +add_subdirectory(test) + #-----------------------------------------------------------------------------# # Package configuration # diff --git a/src/api/java/CMakeLists.txt b/src/api/java/CMakeLists.txt index d56f594ce..53ea46f46 100644 --- a/src/api/java/CMakeLists.txt +++ b/src/api/java/CMakeLists.txt @@ -112,5 +112,3 @@ add_jar(cvc5jar ) add_dependencies(cvc5jar generate-java-kinds cvc5jni cvc5) - -get_target_property(CVC5_JAR_PATH cvc5jar JAR_FILE) \ No newline at end of file diff --git a/test/unit/api/java/CMakeLists.txt b/test/unit/api/java/CMakeLists.txt index 0ef649b87..fe497ef3b 100644 --- a/test/unit/api/java/CMakeLists.txt +++ b/test/unit/api/java/CMakeLists.txt @@ -17,6 +17,8 @@ find_package(Java REQUIRED) include(UseJava) find_package(JUnit REQUIRED) +get_target_property(CVC5_JAR_PATH cvc5jar JAR_FILE) + # specify source files for junit tests set(java_test_src_files ${CMAKE_CURRENT_SOURCE_DIR}/cvc5/SolverTest.java -- 2.30.2