From 0da537d16792ffcc38ec1fb19d518900b1fe7432 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Sun, 25 Apr 2010 16:05:21 -0400 Subject: [PATCH] Do not error out if the java version is not found, if java is not required. --- Modules/FindJava.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 7eb6d900c..9e2a64095 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -82,7 +82,11 @@ IF(Java_JAVA_EXECUTABLE) OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) IF( res ) - MESSAGE( FATAL_ERROR "Error executing java -version" ) + IF(${Java_FIND_REQUIRED}) + MESSAGE( FATAL_ERROR "Error executing java -version" ) + ELSE() + MESSAGE( STATUS "Warning, could not run java --version") + ENDIF() ELSE() # extract major/minor version and patch level from "java -version" output # Tested on linux using