$NetBSD$

Fix build on FreeBSD (link against libcompat)

--- src/Main/CMakeLists.txt.orig	2016-04-07 01:39:34.000000000 +0000
+++ src/Main/CMakeLists.txt
@@ -20,6 +20,10 @@ else(BUILD_GUI)
     )
 endif(BUILD_GUI)
 
+IF(HOMEDIR)
+    add_definitions(-DHOMEDIR="${HOMEDIR}")
+ENDIF(HOMEDIR)
+
 ######################## FreeCADMain ########################
 if(BUILD_GUI)
 
@@ -34,6 +38,11 @@ if(BUILD_GUI)
             FreeCADGui
             ${QT_QTMAIN_LIBRARY}
         )
+    elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+        SET(FreeCAD_LIBS
+            FreeCADGui
+            -lcompat
+        )
     else(MSVC)
         SET(FreeCAD_LIBS
             FreeCADGui
@@ -63,11 +72,20 @@ SET(FreeCADMainCmd_SRCS
 )
 add_executable(FreeCADMainCmd ${FreeCADMainCmd_SRCS})
 
-target_link_libraries(FreeCADMainCmd 
-    FreeCADApp
-    ${QT_QTCORE_LIBRARY}
-    ${QT_QTXML_LIBRARY}
-)
+if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
+    target_link_libraries(FreeCADMainCmd
+        FreeCADApp
+        -lcompat
+        ${QT_QTCORE_LIBRARY}
+        ${QT_QTXML_LIBRARY}
+    )
+else()
+    target_link_libraries(FreeCADMainCmd
+        FreeCADApp
+        ${QT_QTCORE_LIBRARY}
+        ${QT_QTXML_LIBRARY}
+    )
+endif()
 
 SET_BIN_DIR(FreeCADMainCmd FreeCADCmd)
 
