← Back to team overview

kicad-developers team mailing list archive

[PATCH] Set _USE_MATH_DEFINES on Windows

 

In standard compliant mode, msys2 behaves like msvc and does not define
M_PI et al. without _USE_MATH_DEFINES
---
 CMakeLists.txt | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e3bca991fc..2421e024bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -181,6 +181,13 @@ include( PerformFeatureChecks )
 perform_feature_checks()
 
 
+# On Windows (all compilers), M_PI et al. are only defined if
+# _USE_MATH_DEFINES is defined.
+if( WIN32 )
+    add_definitions(-D_USE_MATH_DEFINES)
+endif()
+
+
 # Workaround: CMake < 3.1 does not support CMAKE_CXX_STANDARD
 if( NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 3.1 )
     message( FATAL_ERROR "Remove compatibility code" )

Follow ups