← Back to team overview

kicad-developers team mailing list archive

[PATCH 1/3] 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 | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf55d49e7b..9c835aaeab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -181,6 +181,12 @@ include( PerformFeatureChecks )
 perform_feature_checks()
 
 
+if( WIN32 )
+    # Enable definitions for M_PI et al.
+    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" )

References