diff --git a/CMakeLists.txt b/CMakeLists.txt index f5b08c1e..5aa640b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,15 +55,7 @@ if (UNIX AND NOT APPLE) list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY}) - find_library(MATH_LIBRARY m) - if (MATH_LIBRARY) - list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) - endif() - - find_library(RT_LIBRARY rt) - if (RT_LIBRARY) - list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) - endif() + set(GLFW_PKGLIBS "gl x11") include(CheckFunctionExists) include(CheckSymbolExists) @@ -76,6 +68,7 @@ if (UNIX AND NOT APPLE) set(_GLFW_HAS_XRANDR 1) list(APPEND GLFW_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH}) list(APPEND GLFW_LIBRARIES ${X11_Xrandr_LIB}) + set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") endif() # Check for Xf86VidMode (fallback legacy resolution switching extension) @@ -90,6 +83,8 @@ if (UNIX AND NOT APPLE) else() list(APPEND GLFW_LIBRARIES Xxf86vm) endif() + + set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm") endif() # Check for Xkb (X keyboard extension) @@ -98,6 +93,18 @@ if (UNIX AND NOT APPLE) list(APPEND GLFW_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH}) endif() + find_library(RT_LIBRARY rt) + if (RT_LIBRARY) + list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) + set(GLFW_PKGLIBS "${GLFW_PKGLIBS} rt") + endif() + + find_library(MATH_LIBRARY m) + if (MATH_LIBRARY) + list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) + set(GLFW_PKGLIBS "${GLFW_PKGLIBS} m") + endif() + check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS) if (NOT _GLFW_HAS_GLXGETPROCADDRESS) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e508f259..aa7fbf30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,14 +1,9 @@ if (UNIX) - if (_GLFW_HAS_XRANDR) - set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") - endif() - if (_GLFW_HAS_XF86VIDMODE) - set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm") - endif() configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc + DESTINATION lib/pkgconfig) endif() include_directories(${GLFW_SOURCE_DIR}/src diff --git a/src/libglfw.pc.cmake b/src/libglfw.pc.cmake index 47cfb4f5..164fdc26 100644 --- a/src/libglfw.pc.cmake +++ b/src/libglfw.pc.cmake @@ -7,6 +7,6 @@ Name: GLFW Description: A portable library for OpenGL, window and input Version: 3.0.0 URL: http://www.glfw.org/ -Requires.private: gl x11 @GLFW_PKGLIBS@ +Requires.private: @GLFW_PKGLIBS@ Libs: -L${libdir} -lglfw Cflags: -I${includedir}