Index: CMakeLists.txt
--- CMakeLists.txt.orig
+++ CMakeLists.txt
@@ -25,11 +25,15 @@ set(CMAKE_MODULE_PATH
 )
 
 set(CMAKE_AUTOMOC ON)
+set(CMAKE_NO_SYSTEM_FROM_IMPORTED ON)
+
 include(MacroOutOfSourceBuild)
 MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
     "We don't support building in source, please create a build folder elsewhere and remember to run git clean -xdf to remove temporary files created by CMake."
 )
 
+set(WRKINST "replaceme" CACHE STRING "")
+
 #Option for memory debugging
 option(SUBSURFACE_ASAN_BUILD "enable memory debugging of Subsurface binary" OFF)
 
@@ -58,6 +62,9 @@ option(LIBRAW_SUPPORT "enable support for LibRaw image
 # Options regarding What should we build on subsurface
 option(BUILD_TESTS "Build the tests" OFF)
 
+include_directories(${CMAKE_SOURCE_DIR}/libdivecomputer/built/include)
+include_directories(${CMAKE_INSTALL_PREFIX}/include/grantlee5)
+
 # Option whether we should try to build against Qt6, if it is available
 option(BUILD_WITH_QT6 "try to build against Qt6 (incomplete)" OFF)
 
@@ -146,7 +153,6 @@ include(pkgconfig_helper)
 # if you think a module miss anything, take a look on the specific
 # module file.
 include(HandleFindGit2)
-include(HandleFindLibDiveComputer)
 include(HandleFtdiSupport)
 include(HandleVersionGeneration)
 include(RunOnBuildDir)
@@ -189,7 +195,7 @@ endif()
 # ended up failing in subtle ways to do what was advertized; in the Qt5 case
 # some of the variables didn't get set up, so we'll immediately call it again
 # for Qt5
-find_package(QT NAMES ${CHECK_QT6} Qt5 REQUIRED COMPONENTS Core Widgets)
+find_package(QT NAMES ${CHECK_QT6} Qt5 HINTS "/usr/local/lib/qt5/cmake/Qt5" REQUIRED COMPONENTS Core Widgets)
 
 # right now there are a few things that don't work with Qt6
 # let's disable them right here and remember our Qt version
@@ -428,7 +434,7 @@ if(NOT ANDROID)
 endif()
 
 #set up the subsurface_link_libraries variable
-LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
+LIST(APPEND SUBSURFACE_LINK_LIBRARIES ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
 if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
 	if(USINGQT6)
 		if(MAPSUPPORT)
@@ -447,6 +453,10 @@ if(DEFINED ENV{LGTM_SRC})
 	LIST(APPEND SUBSURFACE_LINK_LIBRARIES -lgssapi_krb5 -lhttp_parser)
 endif()
 
+if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
+	add_subdirectory(desktop-widgets)
+endif()
+
 # include translations
 if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
 add_subdirectory(translations)
@@ -464,9 +474,6 @@ add_subdirectory(stats)
 endif()
 add_subdirectory(backend-shared)
 
-if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
-	add_subdirectory(desktop-widgets)
-endif()
 
 # create the executables
 if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
@@ -528,6 +535,9 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopE
 		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 ${CMAKE_SOURCE_DIR}/libdivecomputer/built/lib/libdivecomputer.a)
+
 	target_link_libraries(
 		${SUBSURFACE_TARGET}
 		subsurface_generated_ui
@@ -538,6 +548,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopE
 		subsurface_models_desktop
 		subsurface_commands
 		subsurface_corelib
+		subsurface_dc
 		subsurface_stats
 		${SUBSURFACE_LINK_LIBRARIES}
 	)
@@ -749,11 +760,12 @@ 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
-	file(GLOB_RECURSE GOOGLEMAPS ${CMAKE_SOURCE_DIR}/../install-root/libqtgeoservices_googlemaps.so)
+	SET(GOOGLEMAPS "${WRKINST}/usr/local/lib/qt5/plugins/geoservices/libqtgeoservices_googlemaps.so" CACHE STRING "googlemaps.so")
+	message(STATUS "GOOGLEMAPS=${GOOGLEMAPS}")
 	if (NOT GOOGLEMAPS)
 		message(STATUS "Cannot find libqtgeoservices_googlemaps.so")
 	else()
