summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCosmin Truta <ctruta@gmail.com>2018-11-17 21:31:55 -0500
committerCosmin Truta <ctruta@gmail.com>2018-11-17 21:31:55 -0500
commitee7967eea439145673fa89e2d7d56d4932c182cc (patch)
tree05ceefb25617ed7333a37b119aa69966e106b673
parenta54a0562c53daf2d627f1631be0dd6531cca1694 (diff)
CMakeLists: Fix detection of libm
Only use libm on Unix and Unix-like systems, except for Apple (where it's unnecessary), and BeOS and Haiku (where it's unavailable). Avoid searching for libm at explicit locations. They may be incorrect, especially for cross-platform builds.
-rw-r--r--CMakeLists.txt12
1 files changed, 3 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a49127d06..58332a85a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -59,16 +59,10 @@ if(NOT PNG_BUILD_ZLIB)
include_directories(${ZLIB_INCLUDE_DIR})
endif()
-if(NOT WIN32)
- find_library(M_LIBRARY
- NAMES m
- PATHS /usr/lib /usr/local/lib)
- if(NOT M_LIBRARY)
- message(STATUS "math lib 'libm' not found; floating point support disabled")
- set(M_LIBRARY "")
- endif()
+if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
+ find_library(M_LIBRARY m)
else()
- # not needed on windows
+ # libm is not needed and/or not available
set(M_LIBRARY "")
endif()