diff --git a/CMakeLists.txt b/CMakeLists.txt
index 92a3afb719ecce65d88b58b8ae207c6be84069ae..efc8a8b05d2956f7b0debadd5d50ac28b1e0d2ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1083,16 +1083,20 @@ endif(WIN32 OR CYGWIN)
 # force full warnings to encourage everybody to write clean(er) code
 check_cxx_compiler_flag("-Wall" WALL)
 check_cxx_compiler_flag("-Wint-to-void-pointer-cast" WCAST)
+check_cxx_compiler_flag("-Wdeprecated-declarations" WDEPREC)
 if(WALL AND NOT MSVC)
   file(GLOB_RECURSE WALL_SRC Common/*.cpp Fltk/*.cpp FunctionSpace/*.cpp
        Geo/*.cpp Graphics/*.cpp Mesh/*.cpp Numeric/*.cpp Parser/*.cpp
        Plugin/*.cpp Post/*.cpp Qt/*.cpp Solver/*.cpp)
+  set(WF "-Wall")
   if(WCAST)
-    set_source_files_properties(${WALL_SRC} PROPERTIES COMPILE_FLAGS 
-                                "-Wall -Wno-int-to-void-pointer-cast")
-  else(WCAST)
-    set_source_files_properties(${WALL_SRC} PROPERTIES COMPILE_FLAGS "-Wall")
+    set(WF "${WF} -Wno-int-to-void-pointer-cast")
   endif(WCAST)
+  if(WDEPREC)
+    # FIXME: remove this when we have fixed the deprecated GLU code for OpenGL3
+    set(WF "${WF} -Wno-deprecated-declarations")
+  endif(WDEPREC)
+  set_source_files_properties(${WALL_SRC} PROPERTIES COMPILE_FLAGS ${WF})
 endif(WALL AND NOT MSVC)
 
 # don't issue warnings for contributed libraries