FindJava: Do not accept OS X stub 'java' as Java

OS X provides a stub 'java' to inform callers that Java is not present.
When checking the 'java -version' output, look for such a message and if
found pretend 'java' was not found.

Suggested-by: Sean McBride <sean@rogue-research.com>
This commit is contained in:
Brad King 2014-10-24 14:42:46 -04:00
parent 54ff77dc62
commit dd378258f1
1 changed files with 4 additions and 1 deletions

View File

@ -115,7 +115,10 @@ if(Java_JAVA_EXECUTABLE)
OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_STRIP_TRAILING_WHITESPACE)
if( res )
if(${Java_FIND_REQUIRED})
if(var MATCHES "No Java runtime present, requesting install")
set_property(CACHE Java_JAVA_EXECUTABLE
PROPERTY VALUE "Java_JAVA_EXECUTABLE-NOTFOUND")
elseif(${Java_FIND_REQUIRED})
message( FATAL_ERROR "Error executing java -version" )
else()
message( STATUS "Warning, could not run java -version")