Skip to content

Tests: Use Java_JAVAC_EXECUTABLE variable consistently

Craig Scott requested to merge craig.scott/cmake:tests-java-compiler-var into master

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.

Merge request reports