Description: Add the missing libraries
 Add missing library to link step of libfreecnect and libfakenect.
 Centralize also the definition of MATH_LIB
Origin: vendor
Forwarded: no
Author: Nicolas Bourdaud <nicolas.bourdaud@gmail.com>
Last-Update: 2012-01-26

--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -4,6 +4,7 @@
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(${LIBUSB_1_INCLUDE_DIRS})
+find_package(Threads REQUIRED)
 
 # Audio Firmware
 include(FindPythonInterp)
@@ -36,8 +37,8 @@ ENDIF()
 install (TARGETS freenectstatic
   DESTINATION "${PROJECT_LIBRARY_INSTALL_DIR}")
 
-target_link_libraries (freenect ${LIBUSB_1_LIBRARIES})
-target_link_libraries (freenectstatic ${LIBUSB_1_LIBRARIES})
+target_link_libraries(freenect ${LIBUSB_1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
+target_link_libraries(freenectstatic ${LIBUSB_1_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
 
 # Install the header files
 install (FILES "../include/libfreenect.h" "../include/libfreenect_registration.h" "../include/libfreenect_audio.h"
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -119,6 +119,12 @@ SET(CMAKE_CXX_FLAGS_DEBUG   "${CMAKE_CXX
 SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS}")
 SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -g")
 
+if (WIN32)
+  set(MATH_LIB "")
+else(WIN32)
+  set(MATH_LIB "m")
+endif()
+
 # Pretty much everyone is going to need the main includes
 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
 
