cmake: quiet glut deprecation warnings on OS X

BUG=webp:187

Change-Id: I652b474dc8389b2219a424d43dec80c3bf9ba62c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a8aadde..89e0c31 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -343,6 +343,12 @@
     target_include_directories(vwebp PRIVATE GLUT::GLUT
       ${CMAKE_CURRENT_BINARY_DIR}/src ${OPENGL_INCLUDE_DIR})
     install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+    if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
+      check_c_compiler_flag("-Wno-deprecated-declarations" HAS_NO_DEPRECATED)
+      if(HAS_NO_DEPRECATED)
+        target_compile_options(vwebp PRIVATE "-Wno-deprecated-declarations")
+      endif()
+    endif()
   endif()
 endif()