diff --git a/CMakeLists.txt b/CMakeLists.txt index fd6713d..c6312b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -938,7 +938,11 @@ OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) # Check for the math library so it can be explicitly linked. IF(NOT WIN32) - FIND_LIBRARY(HAVE_LIBM NAMES math m libm) + INCLUDE(CheckLibraryExists) + CHECK_LIBRARY_EXISTS(m log "" CAN_LINK_LIBM) + IF(CAN_LINK_LIBM) + SET(HAVE_LIBM m) + ENDIF() MESSAGE(STATUS "Found Math library: ${HAVE_LIBM}") IF(NOT HAVE_LIBM) MESSAGE(FATAL_ERROR "Unable to find the math library.")