Skip to content

FindJava: improve failure/verbosity when 'java -version' fails

Seth R Johnson requested to merge sethrj/cmake:findjava into master

On macOS monterey, java -version returns

The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

which does not match the existing regex. Instead of hitting a fatal error if required, reset the variable and let FindPackage handle the result.

If QUIET is requested, don't print anything if the version query fails. Otherwise, print the message.

If the java version query failed, do not look for other java executables (avoiding cache file pollution on macOS with missing java). Additionally, clean up temporary variables set by the execute_process commands.

Merge request reports