$OpenBSD: patch-modules_java_CMakeLists_txt,v 1.1.1.1 2019/03/22 20:39:06 rsadowski Exp $
1. JNI shared object is installed in the same directory, so this should
   be under lib/.
2. Avoid exporting opencv_java together with other targets, unbreaks calling
   find_package(OpenCV) without opencv-java package being installed.
Index: modules/java/CMakeLists.txt
--- modules/java/CMakeLists.txt.orig
+++ modules/java/CMakeLists.txt
@@ -280,7 +280,11 @@ else(ANDROID)
   if(WIN32)
     set(JAR_INSTALL_DIR java)
   else(WIN32)
-    set(JAR_INSTALL_DIR share/OpenCV/java)
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      set(JAR_INSTALL_DIR lib/OpenCV/java)
+    else(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      set(JAR_INSTALL_DIR share/OpenCV/java)
+    endif()
   endif(WIN32)
   install(FILES ${JAR_FILE} DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
 endif(ANDROID)
@@ -359,13 +363,25 @@ if(ANDROID)
           ARCHIVE DESTINATION ${OPENCV_LIB_INSTALL_PATH} COMPONENT java)
 else()
   if(NOT INSTALL_CREATE_DISTRIB)
-    ocv_install_target(${the_module} EXPORT OpenCVModules
-            RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT java
-            LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      ocv_install_target(${the_module}
+              RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT java
+              LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
+    else(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      ocv_install_target(${the_module} EXPORT OpenCVModules
+              RUNTIME DESTINATION ${JAR_INSTALL_DIR} COMPONENT java
+              LIBRARY DESTINATION ${JAR_INSTALL_DIR} COMPONENT java)
+    endif()
   else()
-    ocv_install_target(${the_module} EXPORT OpenCVModules
-            RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java
-            LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java)
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      ocv_install_target(${the_module}
+              RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java
+              LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java)
+    else(${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD")
+      ocv_install_target(${the_module} EXPORT OpenCVModules
+              RUNTIME DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java
+              LIBRARY DESTINATION ${JAR_INSTALL_DIR}/${OpenCV_ARCH} COMPONENT java)
+    endif()
   endif()
 endif()
 
