From fdeb2379347e2bac6a513b30505004e138358d67 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 4 Jun 2022 19:47:50 +1000 Subject: Tests: Use Java_JAVAC_EXECUTABLE variable consistently In certain specific scenarios, it is possible to end up with JAVA_COMPILE being unset, but Java_JAVAC_EXECUTABLE being set. This typically occurs when running different versions of CMake in the same build directory without deleting the CMakeCache.txt each time. This can result in an obscure error about the wrong number of arguments to the get_filename_component() command, but the real cause is the JAVA_COMPILE variable being unset. The JAVA_COMPILE variable is only set by the FindJava module, and it is a legacy variable that has been superceded by Java_JAVAC_EXECUTABLE. The latter is what the if() expression tests, so use that same variable in the body of the if() block for consistency and to avoid the above problem. --- Tests/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7fdfaea..24e98f4 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -3367,7 +3367,7 @@ if(BUILD_TESTING) set(JavaExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}) ADD_TEST_MACRO(JavaExportImport JavaExportImport) - get_filename_component(JNIPATH ${JAVA_COMPILE} PATH) + get_filename_component(JNIPATH ${Java_JAVAC_EXECUTABLE} PATH) find_file(JNI_H jni.h "${JNIPATH}/../include" "${JNIPATH}/../java/include") -- cgit v0.12