summaryrefslogtreecommitdiffstats
path: root/Modules/FindJava.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-10-24 18:42:46 (GMT)
committerBrad King <brad.king@kitware.com>2014-11-19 21:14:56 (GMT)
commitdd378258f1ea07c841f50a6df6a011265441b7e6 (patch)
tree5cc376cfabe18345506080861aeb698af2f1cfc0 /Modules/FindJava.cmake
parent54ff77dc621a91302abad0ab38d9bd26de8914b9 (diff)
downloadCMake-dd378258f1ea07c841f50a6df6a011265441b7e6.zip
CMake-dd378258f1ea07c841f50a6df6a011265441b7e6.tar.gz
CMake-dd378258f1ea07c841f50a6df6a011265441b7e6.tar.bz2
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>
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r--Modules/FindJava.cmake5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 0bd7eb0..be2a90f 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -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")