From 1271dff960cc725180a5f855bab4792852934111 Mon Sep 17 00:00:00 2001 From: Mario Liebisch Date: Thu, 30 Oct 2014 10:53:50 +0100 Subject: [PATCH] Reworked the UDev inclusion * This fixes `SFML_DEPENDENCIES` missing the UDev library for static builds (issue #728). --- cmake/Modules/FindSFML.cmake | 3 +++ src/SFML/Window/CMakeLists.txt | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmake/Modules/FindSFML.cmake b/cmake/Modules/FindSFML.cmake index 68e18690e..c73366e80 100644 --- a/cmake/Modules/FindSFML.cmake +++ b/cmake/Modules/FindSFML.cmake @@ -281,6 +281,7 @@ if(SFML_STATIC_LIBRARIES) if(FIND_SFML_OS_LINUX) find_sfml_dependency(X11_LIBRARY "X11" X11) find_sfml_dependency(XRANDR_LIBRARY "Xrandr" Xrandr) + find_sfml_dependency(UDEV_LIBRARY "UDev" udev) endif() # update the list @@ -290,6 +291,8 @@ if(SFML_STATIC_LIBRARIES) set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "GL" ${X11_LIBRARY} ${XRANDR_LIBRARY}) if(FIND_SFML_OS_FREEBSD) set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "usbhid") + else() + set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} ${UDEV_LIBRARY}) endif() elseif(FIND_SFML_OS_MACOSX) set(SFML_WINDOW_DEPENDENCIES ${SFML_WINDOW_DEPENDENCIES} "-framework OpenGL -framework Foundation -framework AppKit -framework IOKit -framework Carbon") diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index 0d447b4c6..edfa41836 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -199,25 +199,26 @@ if(NOT SFML_OPENGL_ES) endif() include_directories(${X11_INCLUDE_DIR}) endif() - if(SFML_OS_LINUX) - find_package(UDev REQUIRED) - if(NOT UDEV_FOUND) - message(FATAL_ERROR "udev library not found") - endif() - include_directories(${UDEV_INCLUDE_DIR}) - endif() endif() if(SFML_OPENGL_ES AND SFML_OS_LINUX) find_package(EGL REQUIRED) find_package(GLES REQUIRED) include_directories(${EGL_INCLUDE_DIR} ${GLES_INCLUDE_DIR}) endif() +if(SFML_OS_LINUX) + find_package(UDev REQUIRED) + if(NOT UDEV_FOUND) + message(FATAL_ERROR "udev library not found") + endif() + include_directories(${UDEV_INCLUDE_DIR}) +endif() + # build the list of external libraries to link if(SFML_OS_WINDOWS) list(APPEND WINDOW_EXT_LIBS winmm gdi32) elseif(SFML_OS_LINUX) - list(APPEND WINDOW_EXT_LIBS ${X11_X11_LIB} ${X11_Xrandr_LIB} ${UDEV_LIBRARIES}) + list(APPEND WINDOW_EXT_LIBS ${X11_X11_LIB} ${X11_Xrandr_LIB} ${UDEV_LIBRARY}) elseif(SFML_OS_FREEBSD) list(APPEND WINDOW_EXT_LIBS ${X11_X11_LIB} ${X11_Xrandr_LIB} usbhid) elseif(SFML_OS_MACOSX)