Have a look at the bulding applications with cmake and GLFW source chapter which should answer your questions.