GLFW with CMake on Windows, GLFW_INCLUDE_DIRS or GLFW_LIBRARIES not set

@Vinnie Your documentation URL is specific for version 3.0, which is fairly old. Use the latest alias to get the documentation for the most recent release: http://www.glfw.org/docs/latest/build.html

However, half of the relevant section seems to have gone missing. Below are the missing bits:

You don’t need any GLFW_ variables anymore; all necessary dependencies and paths are now stored in the imported glfw CMake target you get from the glfw3 config-file package. Just add glfw as a dependency for your program.

target_link_libraries(myapp glfw)

@dougbinks This also applies to source tree builds. You shouldn’t need the GLFW_ dependency variables anymore either.

Edit: You shouldn’t need include_directories for the GLFW headers either, as that’s also part of the glfw target.

2 Likes