--- src/slic3r/CMakeLists.txt.orig	2025-04-10 11:26:51 UTC
+++ src/slic3r/CMakeLists.txt
@@ -396,11 +396,12 @@ set(SLIC3R_GUI_SOURCES
     Utils/ServiceConfig.cpp
 )
 
-find_package(NanoSVG REQUIRED)
 if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+    find_package(NanoSVG REQUIRED)
+endif()
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
     find_package(OpenSSL REQUIRED)
 endif()
-
 if (APPLE)
     list(APPEND SLIC3R_GUI_SOURCES
             Utils/RetinaHelperImpl.mm
@@ -437,14 +438,13 @@ encoding_check(libslic3r_gui)
 endforeach()
 
 encoding_check(libslic3r_gui)
-
+if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
 target_link_libraries(
     libslic3r_gui
     PUBLIC
     libslic3r
     slic3r-arrange-wrapper
     avrdude
-    libcereal
     imgui
     libvgcode
     GLEW::GLEW
@@ -458,10 +458,29 @@ target_link_libraries(
     fastfloat
     boost_headeronly
 )
+elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+target_link_libraries(
+    libslic3r_gui
+    PUBLIC
+    libslic3r
+    slic3r-arrange-wrapper
+    avrdude
+    imgui
+    libvgcode
+    GLEW::GLEW
+    OpenGL::GL
+    hidapi
+    libcurl
+    ${wxWidgets_LIBRARIES}
+    stb_dxt
+    fastfloat
+    boost_headeronly
+)
+endif()
 
 if (MSVC)
     target_link_libraries(libslic3r_gui PUBLIC Setupapi.lib)
-elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
     target_link_libraries(libslic3r_gui PUBLIC
         ${DBus1_LIBRARIES}
         OpenSSL::SSL
@@ -488,7 +507,7 @@ if (UNIX AND NOT APPLE)
     find_package(GTK${SLIC3R_GTK} REQUIRED)
     find_package(PkgConfig REQUIRED)
 
-    pkg_search_module(WEBKIT2GTK REQUIRED IMPORTED_TARGET webkit2gtk-4.0 webkit2gtk-4.1)
+    pkg_search_module(WEBKIT2GTK REQUIRED IMPORTED_TARGET webkit2gtk-4.1)
     target_link_libraries(libslic3r_gui PUBLIC ${GTK${SLIC3R_GTK}_LIBRARIES} fontconfig PkgConfig::WEBKIT2GTK)
 endif ()
 
