summaryrefslogtreecommitdiffstats
path: root/Tests/CMakeLists.txt
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-06-04 09:47:50 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-06-04 09:47:50 (GMT)
commitfdeb2379347e2bac6a513b30505004e138358d67 (patch)
tree294637f928f06efa7da505d3c7861af57d551525 /Tests/CMakeLists.txt
parentcc2c5d4eb536b220421835ed2eb40729337fd53a (diff)
downloadCMake-fdeb2379347e2bac6a513b30505004e138358d67.zip
CMake-fdeb2379347e2bac6a513b30505004e138358d67.tar.gz
CMake-fdeb2379347e2bac6a513b30505004e138358d67.tar.bz2
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.
Diffstat (limited to 'Tests/CMakeLists.txt')
-rw-r--r--Tests/CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
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")