'Pure OpenGL on Windows? [duplicate]
I want to use OpenGL without GLFW, the docs say that I need to add opengl32.lib
to linker dependencies.
How do I specifically import OpenGL and use it, where is opengl32.lib
and how do I add it to my CMakeLists.txt
or link in Visual Studio's properties?
Solution 1:[1]
You can use the find-module shipped with cmake using find_package(OpenGL)
. When OpenGL is found, you can use the target OpenGL::GL
to link your executable against opengl32.lib
. See the official doc for more targets.
find_package(OpenGL REQUIRED)
add_executable(myApp main.cpp)
target_link_libraries(myApp OpenGL::GL)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | local-ninja |