Unified librt and libm logic.

This commit is contained in:
Camilla Berglund 2015-05-14 16:15:44 +02:00
parent b4f3adb6ee
commit 155da0cd09

View File

@ -210,6 +210,25 @@ else()
message(FATAL_ERROR "No supported platform was detected") message(FATAL_ERROR "No supported platform was detected")
endif() endif()
#--------------------------------------------------------------------
# Find and add Unix math and time libraries
#--------------------------------------------------------------------
if (UNIX AND NOT APPLE)
find_library(RT_LIBRARY rt)
mark_as_advanced(RT_LIBRARY)
if (RT_LIBRARY)
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lrt")
endif()
find_library(MATH_LIBRARY m)
mark_as_advanced(MATH_LIBRARY)
if (MATH_LIBRARY)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lm")
endif()
endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Use Win32 for window creation # Use Win32 for window creation
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -304,20 +323,6 @@ if (_GLFW_X11)
list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}") list(APPEND glfw_INCLUDE_DIR "${X11_Xkb_INCLUDE_PATH}")
find_library(RT_LIBRARY rt)
mark_as_advanced(RT_LIBRARY)
if (RT_LIBRARY)
list(APPEND glfw_LIBRARIES "${RT_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lrt")
endif()
find_library(MATH_LIBRARY m)
mark_as_advanced(MATH_LIBRARY)
if (MATH_LIBRARY)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lm")
endif()
# Check for Xcursor # Check for Xcursor
if (NOT X11_Xcursor_FOUND) if (NOT X11_Xcursor_FOUND)
message(FATAL_ERROR "The Xcursor libraries and headers were not found") message(FATAL_ERROR "The Xcursor libraries and headers were not found")
@ -343,13 +348,6 @@ if (_GLFW_WAYLAND)
list(APPEND glfw_PKG_DEPS "xkbcommon") list(APPEND glfw_PKG_DEPS "xkbcommon")
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
find_library(MATH_LIBRARY m)
mark_as_advanced(MATH_LIBRARY)
if (MATH_LIBRARY)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lm")
endif()
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
@ -366,13 +364,6 @@ if (_GLFW_MIR)
list(APPEND glfw_PKG_DEPS "xkbcommon") list(APPEND glfw_PKG_DEPS "xkbcommon")
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}") list(APPEND glfw_LIBRARIES "${XKBCOMMON_LIBRARY}")
find_library(MATH_LIBRARY m)
mark_as_advanced(MATH_LIBRARY)
if (MATH_LIBRARY)
list(APPEND glfw_LIBRARIES "${MATH_LIBRARY}")
list(APPEND glfw_PKG_LIBS "-lm")
endif()
endif() endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------