diff --git a/CMakeLists.txt b/CMakeLists.txt index 082b1d8..0cba0f0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,17 +48,17 @@ include(CheckFunctionExists) set(LIBM_LIBRARY) CHECK_FUNCTION_EXISTS(log2 LOG2_RES) if(NOT LOG2_RES) - unset(LOG2_RES) set(orig_req_libs "${CMAKE_REQUIRED_LIBRARIES}") set(CMAKE_REQUIRED_LIBRARIES "${CMAKE_REQUIRED_LIBRARIES};m") - CHECK_FUNCTION_EXISTS(log2 LOG2_RES) - if(LOG2_RES) + CHECK_FUNCTION_EXISTS(log2 LOG2_LIBM_RES) + if(LOG2_LIBM_RES) set(LIBM_LIBRARY "m") else() message(FATAL_ERROR "log2() not found") endif() set(CMAKE_REQUIRED_LIBRARIES "${orig_req_libs}") + unset(LOG2_LIBM_RES) unset(orig_req_libs) endif() unset(LOG2_RES)