diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2a61ab1..7c9b2c2e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -211,7 +211,13 @@ if (_GLFW_X11)
     endif()
 
     list(APPEND glfw_INCLUDE_DIRS ${X11_Xinput_INCLUDE_PATH})
-    list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
+
+    if (X11_Xinput_LIB)
+        list(APPEND glfw_LIBRARIES ${X11_Xinput_LIB})
+    else()
+        # Backwards compatibility (bug in CMake 2.8.7)
+        list(APPEND glfw_LIBRARIES Xi)
+    endif()
     set(GLFW_PKG_DEPS "${GLFW_PKG_DEPS} xi")
 
     # Check for Xf86VidMode (fallback gamma control)
diff --git a/README.md b/README.md
index 511f73a5..c9d60fcc 100644
--- a/README.md
+++ b/README.md
@@ -207,6 +207,7 @@ See the [GLFW documentation](http://www.glfw.org/docs/latest/).
  - [Win32] Bugfix: `_WIN32_WINNT` was not set to Windows XP or later
  - [Win32] Bugfix: Legacy MinGW needs `WINVER` and `UNICODE` before `stddef.h`
  - [X11] Bugfix: Events for mouse buttons 4 and above were not reported
+ - [X11] Bugfix: CMake 2.8.7 does not set `X11_Xinput_LIB` even when found
 
 
 ## Contact
@@ -277,6 +278,7 @@ skills.
  - Bruce Mitchener
  - Jeff Molofee
  - Jon Morton
+ - Pierre Moulon
  - Julian Møller
  - Ozzy
  - Peoro