Pkg-config dependency generation fixes.

This commit is contained in:
Camilla Berglund 2012-03-25 14:51:56 +02:00
parent 4a905d2e28
commit d743793e71
3 changed files with 19 additions and 17 deletions

View File

@ -55,15 +55,7 @@ if (UNIX AND NOT APPLE)
list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR})
list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY})
find_library(MATH_LIBRARY m) set(GLFW_PKGLIBS "gl x11")
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()
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckSymbolExists) include(CheckSymbolExists)
@ -76,6 +68,7 @@ if (UNIX AND NOT APPLE)
set(_GLFW_HAS_XRANDR 1) set(_GLFW_HAS_XRANDR 1)
list(APPEND GLFW_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH}) list(APPEND GLFW_INCLUDE_DIR ${X11_Xrandr_INCLUDE_PATH})
list(APPEND GLFW_LIBRARIES ${X11_Xrandr_LIB}) list(APPEND GLFW_LIBRARIES ${X11_Xrandr_LIB})
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
endif() endif()
# Check for Xf86VidMode (fallback legacy resolution switching extension) # Check for Xf86VidMode (fallback legacy resolution switching extension)
@ -90,6 +83,8 @@ if (UNIX AND NOT APPLE)
else() else()
list(APPEND GLFW_LIBRARIES Xxf86vm) list(APPEND GLFW_LIBRARIES Xxf86vm)
endif() endif()
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
endif() endif()
# Check for Xkb (X keyboard extension) # Check for Xkb (X keyboard extension)
@ -98,6 +93,18 @@ if (UNIX AND NOT APPLE)
list(APPEND GLFW_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH}) list(APPEND GLFW_INCLUDE_DIR ${X11_Xkb_INCLUDE_PATH})
endif() 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) check_function_exists(glXGetProcAddress _GLFW_HAS_GLXGETPROCADDRESS)
if (NOT _GLFW_HAS_GLXGETPROCADDRESS) if (NOT _GLFW_HAS_GLXGETPROCADDRESS)

View File

@ -1,14 +1,9 @@
if (UNIX) 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 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) ${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() endif()
include_directories(${GLFW_SOURCE_DIR}/src include_directories(${GLFW_SOURCE_DIR}/src

View File

@ -7,6 +7,6 @@ Name: GLFW
Description: A portable library for OpenGL, window and input Description: A portable library for OpenGL, window and input
Version: 3.0.0 Version: 3.0.0
URL: http://www.glfw.org/ URL: http://www.glfw.org/
Requires.private: gl x11 @GLFW_PKGLIBS@ Requires.private: @GLFW_PKGLIBS@
Libs: -L${libdir} -lglfw Libs: -L${libdir} -lglfw
Cflags: -I${includedir} Cflags: -I${includedir}