--- src/slic3r/CMakeLists.txt.orig	2026-03-05 08:59:10 UTC
+++ src/slic3r/CMakeLists.txt
@@ -665,6 +665,15 @@ elseif (APPLE)
     )
 elseif (APPLE)
     target_link_libraries(libslic3r_gui ${DISKARBITRATION_LIBRARY} "-framework Security")
+elseif (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+    find_package(PkgConfig REQUIRED)
+    pkg_check_modules(DBUS REQUIRED dbus-1)
+    find_package(CURL REQUIRED)
+    target_include_directories(libslic3r_gui SYSTEM PRIVATE ${DBUS_INCLUDE_DIRS})
+    target_link_libraries(libslic3r_gui
+        ${DBUS_LIBRARIES}
+        ${CURL_LIBRARIES}
+    )
 endif()
 
 if (SLIC3R_STATIC)
@@ -674,7 +683,8 @@ if (SPNAV_LIB)
 endif()
 
 if (SPNAV_LIB)
-    target_link_libraries(libslic3r_gui ${SPNAV_LIB})
+    find_package(X11 REQUIRED)
+    target_link_libraries(libslic3r_gui ${SPNAV_LIB} ${X11_LIBRARIES})
 endif()
 
 if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_CURL AND UNIX AND NOT APPLE)
@@ -692,6 +702,8 @@ if (UNIX AND NOT APPLE)
     find_package(PkgConfig REQUIRED)
     find_package(GTK${SLIC3R_GTK} REQUIRED)
     pkg_check_modules(LIBSECRET REQUIRED libsecret-1)
+    pkg_check_modules(webkit2gtk REQUIRED webkit2gtk-4.1)
+    target_link_libraries (libslic3r_gui ${X11_LIBRARIES} ${webkit2gtk_LIBRARIES})
     if (FLATPAK)
         # I don't know why this is needed, but for whatever reason slic3r isn't
         # linking to X11 and webkit2gtk. force it.
