[cmake-developers] OpenBSD patches: part 2

Amit Kulkarni amitkulz at gmail.com
Mon Dec 3 18:23:10 EST 2012


Commit message: set the default JRE and JDK paths for Java versions 1.6.0 and 1.7.0 on OpenBSD

diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake
index c4217f5..ae9f5fc 100644
--- a/Modules/CMakeDetermineJavaCompiler.cmake
+++ b/Modules/CMakeDetermineJavaCompiler.cmake
@@ -63,6 +63,8 @@ if(NOT CMAKE_Java_COMPILER)
     /usr/java/j2sdk1.4.2_09/bin
     /usr/lib/j2sdk1.5-sun/bin
     /opt/sun-jdk-1.5.0.04/bin
+    /usr/local/jdk-1.7.0/bin
+    /usr/local/jdk-1.6.0/bin
     )
   # if no compiler has been specified yet, then look for one
   if(CMAKE_Java_COMPILER_INIT)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 0de3f79..9d708ca 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -120,6 +120,11 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
   /usr/lib/jvm/default-java/jre/lib/{libarch}
   /usr/lib/jvm/default-java/jre/lib
   /usr/lib/jvm/default-java/lib
+  # OpenBSD specific paths for default JVM
+  /usr/local/jdk-1.7.0/jre/lib/{libarch}
+  /usr/local/jre-1.7.0/lib/{libarch}
+  /usr/local/jdk-1.6.0/jre/lib/{libarch}
+  /usr/local/jre-1.6.0/lib/{libarch}
   )
 
 set(JAVA_JVM_LIBRARY_DIRECTORIES)
@@ -153,6 +158,9 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
   /opt/sun-jdk-1.5.0.04/include
   # Debian specific path for default JVM
   /usr/lib/jvm/default-java/include
+  # OpenBSD specific path for default JVM
+  /usr/local/jdk-1.7.0/include
+  /usr/local/jdk-1.6.0/include
   )
 
 foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
@@ -227,6 +235,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h
   ${JAVA_INCLUDE_PATH}/win32
   ${JAVA_INCLUDE_PATH}/linux
   ${JAVA_INCLUDE_PATH}/freebsd
+  ${JAVA_INCLUDE_PATH}/openbsd
   ${JAVA_INCLUDE_PATH}/solaris
   ${JAVA_INCLUDE_PATH}/hp-ux
   ${JAVA_INCLUDE_PATH}/alpha
diff --git a/Modules/FindJava.cmake b/Modules/FindJava.cmake
index 1b4593d..2f02b7a 100644
--- a/Modules/FindJava.cmake
+++ b/Modules/FindJava.cmake
@@ -80,6 +80,8 @@ set(_JAVA_PATHS
   /usr/java/j2sdk1.4.2_09/bin
   /usr/lib/j2sdk1.5-sun/bin
   /opt/sun-jdk-1.5.0.04/bin
+  /usr/local/jdk-1.7.0/bin
+  /usr/local/jdk-1.6.0/bin
   )
 find_program(Java_JAVA_EXECUTABLE
   NAMES java
@@ -107,6 +109,7 @@ if(Java_JAVA_EXECUTABLE)
       # 2. OpenJDK 1.6
       # 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_.]+.*\".*")
         # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
         string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
@@ -115,6 +118,10 @@ if(Java_JAVA_EXECUTABLE)
         # 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_]+\".*")
+        # OpenJDK ver 1.7.x on OpenBSD
+        string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
+                "\\1" Java_VERSION_STRING "${var}" )
       else()
         if(NOT Java_FIND_QUIETLY)
           message(WARNING "regex not supported: ${var}. Please report")



More information about the cmake-developers mailing list