diff options
Diffstat (limited to 'Modules/FindJava.cmake')
-rw-r--r-- | Modules/FindJava.cmake | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake index a488c46..0bd7eb0 100644 --- a/Modules/FindJava.cmake +++ b/Modules/FindJava.cmake @@ -128,18 +128,15 @@ if(Java_JAVA_EXECUTABLE) # 3. GCJ 1.5 # 4. Kaffe 1.4.2 # 5. OpenJDK 1.7.x on OpenBSD - if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*") + if(var MATCHES "java version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\"") # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer - string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*" - "\\1" Java_VERSION_STRING "${var}" ) - elseif(var MATCHES "java full version \"kaffe-[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + elseif(var MATCHES "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+)\"") # Kaffe style - string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*" - "\\1" Java_VERSION_STRING "${var}" ) - elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*") + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") + elseif(var MATCHES "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+)\"") # OpenJDK ver 1.7.x on OpenBSD - string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*" - "\\1" Java_VERSION_STRING "${var}" ) + set(Java_VERSION_STRING "${CMAKE_MATCH_1}") else() if(NOT Java_FIND_QUIETLY) message(WARNING "regex not supported: ${var}. Please report") |