I was getting similar linking errors. My error was saying:
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x16d3): undefined reference to `XIQueryVersion'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `createWindow':
x11_window.c:(.text+0x6de): undefined reference to `XISelectEvents'
But since I wanted Cmake linking flags for the required linking libs, it took me a while to do so. Required external libs, to compile glfw based program, are:
Requires.private: x11 xrandr xi xxf86vm gl
This thread shows how to find these libs needed to compile glfw based program.
Since, I spent 2-3 hours looking for Cmake linking flags for the above additional linking libs. I think it's worth mentioning here to help others.
Mainly for the error I have mentioned above, I just needed a cmake linking flag for xi
only, but for completeness sake I am mentioning for all of them, i.e. x11 xrandr xi xxf86vm
. Here is the snippet from my CMakeLists.txt
file:
include_directories(
./src
${X11_xf86vmode_INCLUDE_PATH}
${X11_Xrandr_INCLUDE_PATH}
${X11_Xinput_INCLUDE_PATH}
)
target_link_libraries(
${GLFW_LIBRARIES}
${X11_LIBRARIES}
${X11_Xxf86vm_LIB}
${X11_Xrandr_LIB}
${X11_Xinput_LIB}
)
I extracted these flags from this link.
Hope, it will save time for others. Enjoy!