          qhull rbox qconvex qdelaunay qvoronoi qhalf
          user_eg user_eg2 user_eg3
  )
-@@ -188,17 +188,32 @@
+@@ -188,17 +188,34 @@
      COMPILE_DEFINITIONS "qh_QHpointer"
      VERSION ${qhull_VERSION})
  

+    COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG}
+    VERSION ${qhull_VERSION})
+
+target_link_libraries(${qhull_SHARED} m)
+target_link_libraries(${qhull_SHARED_DEBUG} m)
 
 if(UNIX)
     if(APPLE)

+    VERSION ${qhull_VERSION} 
+    COMPILE_FLAGS ${CMAKE_CXX_FLAGS_DEBUG})
+
+if(UNIX)
+  target_link_libraries(${qhull_STATIC} m)
+  target_link_libraries(${qhull_STATIC_DEBUG} m)
+  target_link_libraries(${qhull_STATICP} m)
+  target_link_libraries(${qhull_STATICP_DEBUG} m)
+endif(UNIX)
+
 # ---------------------------------------
 # Define C++ static library qhullcpp (qh_QHpointer)
 # ---------------------------------------
@@ -224,6 +259,12 @@
     COMPILE_DEFINITIONS "qh_QHpointer"
     VERSION ${qhull_VERSION})
 
