Skip to content

Set _USE_MATH_DEFINES for MSVC builds.

Ralph Giles requested to merge math_defines into master

Add this define to lib/os.h and test/util.c so M_PI is available when building with Microsoft's math.h. On other systems, it's typically enabled by default, e.g. through __USE_XOPEN or __USE_GNU.

We already had a fallback definition of M_PI in os.h which was used by the core library, but not included in the test harness, which failed to compile under CMake and MSVC.

Using the system define should be more consistent.

Based on a patch by Ozkan Sezer.

Merge request reports