diff options
author | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2009-11-04 10:17:46 (GMT) |
---|---|---|
committer | Mathieu Malaterre <mathieu.malaterre@gmail.com> | 2009-11-04 10:17:46 (GMT) |
commit | b0960683b2e035ca45470d1bc0a1c6886fc29748 (patch) | |
tree | 0220270c9297ac3beebddd461cdd1c35622cebaf /Modules/FindJava.cmake | |
parent | b1817590c15ee49723e863be5b9e82eb5e477db4 (diff) | |
download | CMake-b0960683b2e035ca45470d1bc0a1c6886fc29748.zip CMake-b0960683b2e035ca45470d1bc0a1c6886fc29748.tar.gz CMake-b0960683b2e035ca45470d1bc0a1c6886fc29748.tar.bz2 |
Adding support for java 1.6.0-oem. Make sure to report failure when user ask for version but regex failed to parse version number
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r-- | Modules/FindJava.cmake | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index 252af19..3f19921 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -60,6 +60,7 @@ FIND_PROGRAM(Java_JAVA_EXECUTABLE ) IF(Java_JAVA_EXECUTABLE) + set(_java_version_acceptable TRUE) EXECUTE_PROCESS(COMMAND ${Java_JAVA_EXECUTABLE} -version RESULT_VARIABLE res OUTPUT_VARIABLE var @@ -71,13 +72,13 @@ IF(Java_JAVA_EXECUTABLE) ELSE() # extract major/minor version and patch level from "java -version" output # Tested on linux using - # 1. Sun + # 1. Sun / Sun OEM # 2. OpenJDK 1.6 # 3. GCJ 1.5 # 4. Kaffe 1.4.2 - IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + IF(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_]+[oem-]*\".*") # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*" + STRING( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_]+)[oem-]*\".*" "\\1" Java_VERSION_STRING "${var}" ) ELSEIF(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") # Kaffe style @@ -85,7 +86,8 @@ IF(Java_JAVA_EXECUTABLE) "\\1" Java_VERSION_STRING "${var}" ) ELSE() IF(NOT Java_FIND_QUIETLY) - message(STATUS "regex not supported: ${var}. Please report") + message(WARNING "regex not supported: ${var}. Please report") + set(_java_version_acceptable FALSE) ENDIF(NOT Java_FIND_QUIETLY) ENDIF() STRING( REGEX REPLACE "([0-9]+).*" "\\1" Java_VERSION_MAJOR "${Java_VERSION_STRING}" ) @@ -106,7 +108,6 @@ IF(Java_JAVA_EXECUTABLE) ENDIF() # check version if requested: - set(_java_version_acceptable TRUE) if( Java_FIND_VERSION ) if("${Java_VERSION}" VERSION_LESS "${Java_FIND_VERSION}") set(_java_version_acceptable FALSE) |