commit a88bfd5b77fa0b5c60e438c0011dbdcee5e14dfd
Author: hasufell <hasufell@gentoo.org>
Date:   Mon Nov 25 00:28:55 2013 +0100

    CMAKE: fix linking order
    
    this also fixes linking with as-needed wrt
    https://github.com/minetest/minetest/issues/617

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a1fee7a..a72bd4a 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -427,18 +427,18 @@ if(BUILD_CLIENT)
 	set(minetest_LIBS
 		${PROJECT_NAME}
 		${ZLIB_LIBRARIES}
-		${IRRLICHT_LIBRARY}
+		${X11_LIBRARIES}
 		${OPENGL_LIBRARIES}
+		${OPENGLES2_LIBRARIES}
 		${JPEG_LIBRARIES}
 		${BZIP2_LIBRARIES}
 		${PNG_LIBRARIES}
-		${X11_LIBRARIES}
+		${IRRLICHT_LIBRARY}
 		${GETTEXT_LIBRARY}
 		${SOUND_LIBRARIES}
 		${SQLITE3_LIBRARY}
 		${LUA_LIBRARY}
 		${JSON_LIBRARY}
-		${OPENGLES2_LIBRARIES}
 		${PLATFORM_LIBS}
 		${CLIENT_PLATFORM_LIBS}
 	)