--- ./src/CMakeLists.txt.orig	2014-01-29 21:24:08.000000000 +0000
+++ ./src/CMakeLists.txt	2014-03-30 08:34:09.135721829 +0000
@@ -71,12 +71,13 @@
 
 ADD_CUSTOM_TARGET( confclean COMMAND rm -rf Makefile CMakeFiles/ CMakeCache.txt cmake_install.cmake DartTestfile.txt install_manifest.txt )
 
-find_library(x11 X11)
-IF(x11)
-  TARGET_LINK_LIBRARIES(${PROGNAME} ${QT_LIBRARIES} X11)
-ELSE(x11)
+find_package(X11)
+IF(X11_FOUND)
+  INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
+  TARGET_LINK_LIBRARIES(${PROGNAME} ${QT_LIBRARIES} ${X11_LIBRARIES})
+ELSE(X11_FOUND)
   TARGET_LINK_LIBRARIES(${PROGNAME} ${QT_LIBRARIES})
-ENDIF(x11)
+ENDIF(X11_FOUND)
 
 # only needed for static builds when directx is enabled in qt and you
 # get a linker error because of missing a directx function
@@ -98,6 +99,7 @@
 ADD_TEST(testevaluator testevaluator)
 
 ADD_EXECUTABLE(testfloatnum ${testfloatnum_SOURCES})
+TARGET_LINK_LIBRARIES(testfloatnum m)
 ADD_TEST(testfloatnum testfloatnum)
 
 INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR} thirdparty core gui math)
