--- demo/CMakeLists.txt.orig	2013-11-18 14:51:59.000000000 +0100
+++ demo/CMakeLists.txt	2013-11-18 14:52:21.000000000 +0100
@@ -75,6 +75,7 @@
       set_target_properties(${demo} PROPERTIES COMPILE_FLAGS ${DEMO_C_FLAGS})
     endif(DEMO_C_FLAGS)
   endforeach(demo)
+  target_link_libraries(text_demo2 m)
     
   # the grid_sheet demo needs extra defines
   add_executable(grid_sheet grid_sheet.c)
@@ -86,15 +87,15 @@
   # =======================================================================
   install(
     TARGETS ${demos_NAMES} ${demos_with_grid_NAMES} grid_sheet
-    DESTINATION demo
+    DESTINATION ${EXAMPLESDIR}
   )
   foreach(demo ${demos_NAMES} ${demos_with_grid_NAMES} grid_sheet)
-    install(FILES ${demo}.c DESTINATION demo)
+    install(FILES ${demo}.c DESTINATION ${EXAMPLESDIR})
   endforeach(demo)
 
   # install demo files
   install(
     DIRECTORY images mbtext pngsuite rawimage ttfont type1
-    DESTINATION demo
+    DESTINATION ${EXAMPLESDIR}
   )
 endif(LIBHPDF_EXAMPLES)
