Browse Source

cmake: get rid of the duplicated _USE_MATH_DEFINES
- define _USE_MATH_DEFINES in SDL_stdinc.h only
- define _USE_MATH_DEFINES if not defined already

pionere 2 years ago
parent
commit
68b30d24e0
2 changed files with 1 additions and 2 deletions
  1. 0 1
      CMakeLists.txt
  2. 1 1
      include/SDL_stdinc.h

+ 0 - 1
CMakeLists.txt

@@ -999,7 +999,6 @@ if(SDL_LIBC)
     endforeach()
     endforeach()
     set(HAVE_ALLOCA 1)
     set(HAVE_ALLOCA 1)
     check_symbol_exists(M_PI math.h HAVE_M_PI)
     check_symbol_exists(M_PI math.h HAVE_M_PI)
-    target_compile_definitions(sdl-build-options INTERFACE "-D_USE_MATH_DEFINES") # needed for M_PI
     set(STDC_HEADERS 1)
     set(STDC_HEADERS 1)
   else()
   else()
     set(HAVE_LIBC TRUE)
     set(HAVE_LIBC TRUE)

+ 1 - 1
include/SDL_stdinc.h

@@ -80,7 +80,7 @@
 # include <ctype.h>
 # include <ctype.h>
 #endif
 #endif
 #ifdef HAVE_MATH_H
 #ifdef HAVE_MATH_H
-# if defined(_MSC_VER)
+# if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
 /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
 /* Defining _USE_MATH_DEFINES is required to get M_PI to be defined on
    Visual Studio.  See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
    Visual Studio.  See http://msdn.microsoft.com/en-us/library/4hwaceh6.aspx
    for more information.
    for more information.