shithub: opusfile

Download patch

ref: 8b2c85b136478357dc6e9fcabc677daebb96a31d
parent: 068e1f4d4d89173c91f3bb44f8365b3313c6a35f
author: Hendrik <git@h3ndrk.de>
date: Mon May 31 16:27:07 EDT 2021

Add math library (fixes static linking)

Signed-off-by: Ralph Giles <giles@thaumas.net>
Signed-off-by: evpobr <evpobr@gmail.com>

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -25,7 +25,11 @@
 include(CMakePushCheckState)
 include(CheckSymbolExists)
 cmake_push_check_state(RESET)
-list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
+include(CheckLibraryExists)
+check_library_exists(m lrintf "" OP_HAVE_LIBM)
+if(OP_HAVE_LIBM)
+  list(APPEND CMAKE_REQUIRED_LIBRARIES "m")
+endif()
 check_symbol_exists(lrintf "math.h" OP_HAVE_LRINTF)
 cmake_pop_check_state()
 
@@ -52,6 +56,7 @@
   PUBLIC
     Ogg::ogg
     Opus::opus
+    $<$<BOOL:OP_HAVE_LIBM>:m>
 )
 target_compile_options(opusfile
   PRIVATE
@@ -155,6 +160,7 @@
       OpenSSL::SSL
       $<$<C_COMPILER_ID:MSVC>:ws2_32>
       $<$<C_COMPILER_ID:MSVC>:crypt32>
+      $<$<BOOL:OP_HAVE_LIBM>:m>
   )
   target_compile_options(opusurl
     PRIVATE