sdl12-compat: cmake: use MATH_LIBRARY variable instead of 'm'

From 349072a2f79ac8e7628837b536cd1513fc933a7e Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 27 Feb 2021 01:22:56 +0300
Subject: [PATCH] cmake: use MATH_LIBRARY variable instead of 'm'

---
 CMakeLists.txt | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 340cfd7..3c2e04e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -73,18 +73,17 @@ endif()
 
 # test programs...
 
+include(FindSDL)
 if(NOT (WIN32 OR APPLE OR CYGWIN OR HAIKU OR BEOS))
   find_library(MATH_LIBRARY m)
 endif()
 
-include(FindSDL)
-
 macro(test_program _NAME _SRCS)
     add_executable(${_NAME} ${_SRCS})
     target_include_directories(${_NAME} PRIVATE ${SDL_INCLUDE_DIR})
     target_link_libraries(${_NAME} SDL)
     if(MATH_LIBRARY)
-       target_link_libraries(${_NAME} m)
+      target_link_libraries(${_NAME} ${MATH_LIBRARY})
     endif()
 endmacro()