--- a/cmake/StaticBuild.cmake	2014-12-25 23:28:45.000000000 -0500
+++ b/cmake/StaticBuild.cmake	2015-01-01 18:18:36.000000000 -0500
@@ -82,10 +82,10 @@
       if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
         set(FLTK_LIBRARIES "${FLTK_LIBRARIES} ${X11_Xcursor_LIB} ${X11_Xfixes_LIB} -Wl,-Bstatic -lXft -Wl,-Bdynamic -lfontconfig -lXext -R/usr/sfw/lib")
       else()
-        set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bstatic -lXcursor -lXfixes -lXft -lfontconfig -lexpat -lfreetype -lbz2 -lXrender -lXext -lXinerama -Wl,-Bdynamic")
+        set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bstatic -lXft -lfontconfig -lfreetype -lXcursor -lXfixes -lz -lbz2 -lXrender -lXinerama -lXext -lexpat -Wl,-Bdynamic")
       endif()
 
-      set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -lX11")
+      set(FLTK_LIBRARIES "${FLTK_LIBRARIES} -Wl,-Bdynamic -lX11 -Wl,-Bstatic -lxcb -lXdmcp -lXau -lICE -Wl,-Bdynamic -ldl")
     endif()
   endif()
 
@@ -93,7 +93,7 @@
   # them statically, even libXext. libX11 is somewhat stable, although
   # even it has had an ABI change once or twice.
   if(X11_FOUND AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
-    set(X11_LIBRARIES "-Wl,-Bstatic -lXext -Wl,-Bdynamic -lX11")
+    set(X11_LIBRARIES "-Wl,-Bstatic -lXext -Wl,-Bdynamic -lX11 -Wl,-Bstatic -lxcb -lXdmcp -lXau -lICE -Wl,-Bdynamic -ldl -lpthread")
     if(X11_XTest_LIB)
       set(X11_XTest_LIB "-Wl,-Bstatic -lXtst -Wl,-Bdynamic")
     endif()
--- a/vncviewer/CMakeLists.txt	2014-11-04 21:38:36.000000000 -0500
+++ b/vncviewer/CMakeLists.txt	2015-01-01 18:15:32.000000000 -0500
@@ -46,7 +46,7 @@
   add_executable(vncviewer ${VNCVIEWER_SOURCES})
 endif()
 
-target_link_libraries(vncviewer rfb network rdr os Xregion ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
+target_link_libraries(vncviewer ${FLTK_LIBRARIES} rfb network rdr os Xregion ${GETTEXT_LIBRARIES})
 
 if(APPLE)
   target_link_libraries(vncviewer "-framework Cocoa" "-framework Carbon")
