Add MSVC-specific #define to expose math constants in <cmath>.

- MSVC does not expose standard math constants, such as M_PI in <cmath>
  or <math.h> unless _USE_MATH_DEFINES is defined prior to their
  inclusion: https://msdn.microsoft.com/en-us/library/4hwaceh6.aspx.
- Use CMake to ensure that this is #defined when both Ceres and the
  examples are compiled, even though it should only be an issue for the
  examples where M_PI is used.

Change-Id: I67af75b100b8138a65514273d23bfe445d92652c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 845c949..ed1425a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -590,6 +590,12 @@
 
 # After the tweaks for the compile settings, disable some warnings on MSVC.
 if (MSVC)
+  # On MSVC, math constants are not included in <cmath> or <math.h> unless
+  # _USE_MATH_DEFINES is defined [1].  As we use M_PI in the examples, ensure
+  # that _USE_MATH_DEFINES is defined before the first inclusion of <cmath>.
+  #
+  # [1] https://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
+  add_definitions("-D_USE_MATH_DEFINES")
   # Disable signed/unsigned int conversion warnings.
   add_definitions("/wd4018")
   # Disable warning about using struct/class for the same symobl.