$OpenBSD$

Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -35,19 +35,21 @@ option(FORCE_LIBSSH "force linking with libssh to work
 option(LIBGIT2_DYNAMIC "search for libgit2.so before libgit2.a" OFF)
 
 #Options regarding disabling parts of subsurface.
-option(NO_DOCS "disable the docs" OFF)
-option(NO_PRINTING "disable the printing support" OFF)
+option(NO_DOCS "disable the docs" ON)
+option(NO_PRINTING "disable the printing support" ON)
 option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
 
 #Options regarding enabling parts of subsurface
 option(FBSUPPORT "allow posting to Facebook" ON)
-option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON)
+option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" OFF)
 option(FTDISUPPORT "enable support for libftdi based serial" OFF)
 option(USE_WEBENGINE "Use QWebEngine instead of QWebKit" OFF)
 
 # Options regarding What should we build on subsurface
-option(MAKE_TESTS "Make the tests" ON)
+option(MAKE_TESTS "Make the tests" OFF)
 
+include_directories(${OPENBSD_LOCALBASE}/include/subsurface)
+
 SET(SUBSURFACE_TARGET_EXECUTABLE "DesktopExecutable" CACHE STRING "The type of application, DesktopExecutable or MobileExecutable")
 LIST(APPEND SUBSURFACE_ACCEPTED_EXECUTABLES  "DesktopExecutable" "MobileExecutable")
 SET_PROPERTY(CACHE SUBSURFACE_TARGET_EXECUTABLE PROPERTY STRINGS ${SUBSURFACE_ACCEPTED_EXECUTABLES})
@@ -260,7 +262,7 @@ if(BLESUPPORT)
 endif()
 
 #set up the subsurface_link_libraries variable
-set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES})
+set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES})
 qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc map-widget/qml/map-widget.qrc)
 
 # include translations
@@ -323,6 +325,9 @@ elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "Deskto
                 add_executable(${SUBSURFACE_TARGET} MACOSX_BUNDLE WIN32 ${SUBSURFACE_PKG} ${SUBSURFACE_APP} ${SUBSURFACE_RESOURCES})
         endif()
 
+	add_library(subsurface_dc STATIC IMPORTED)
+	set_target_properties(subsurface_dc PROPERTIES IMPORTED_LOCATION ${OPENBSD_LOCALBASE}/lib/subsurface/libdivecomputer.a)
+
 	if(FBSUPPORT)
 		set(FACEBOOK_INTEGRATION facebook_integration)
 		add_dependencies(facebook_integration subsurface_generated_ui)
@@ -336,6 +341,7 @@ elseif(${SUBSURFACE_TARGET_EXECUTABLE} MATCHES "Deskto
 		subsurface_statistics
 		subsurface_models_desktop
 		subsurface_corelib
+		subsurface_dc
 		${SUBSURFACE_LINK_LIBRARIES}
 	)
 	add_dependencies(subsurface_desktop_preferences subsurface_generated_ui)
@@ -503,7 +509,7 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
 		COMMAND ${MAKENSIS} ${WINDOWSSTAGING}/subsurface.nsi
 		DEPENDS fake_install
 	)
-elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
 	# the syntax is odd, but this searches for libqtgeoservices_googlemaps.so
 	# in the filesystem below our install-root
 	# different Linux flavors put the plugin in different directories
@@ -516,12 +522,12 @@ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
 			mkdir -p ${CMAKE_BINARY_DIR}/geoservices &&
 			ln -sf ${GOOGLEMAPS} ${CMAKE_BINARY_DIR}/geoservices)
 	endif()
-	install(FILES subsurface.debug DESTINATION bin)
+	#install(FILES subsurface.debug DESTINATION bin)
 	install(FILES subsurface.desktop DESTINATION share/applications)
 	install(FILES appdata/subsurface.appdata.xml DESTINATION share/metainfo)
 	install(FILES icons/subsurface-icon.svg DESTINATION share/icons/hicolor/scalable/apps)
-	install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
-	install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)
+	#install(DIRECTORY Documentation/images DESTINATION share/subsurface/Documentation)
+	#install(FILES ${DOCFILES} DESTINATION share/subsurface/Documentation)
 	install(DIRECTORY theme DESTINATION share/subsurface)
 	install(DIRECTORY printing_templates DESTINATION share/subsurface)
 	install(FILES ${TRANSLATIONS} DESTINATION share/subsurface/translations)
