Created
June 3, 2019 11:32
-
-
Save Subangkar/3d037b6f673172a940e5bb518c8afb3e to your computer and use it in GitHub Desktop.
CMake configuration for running opengl project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.14) | |
project(ProjectName) | |
set(CMAKE_CXX_STANDARD 14) | |
include_directories(OpenGL) | |
include_directories(OpenGL/include) # OpenGL/include has to contain the required OpenGL's .h files | |
include_directories(OpenGL/lib) # OpenGL/lib has to contain the required OpenGL's .lib files | |
# glut32.dll must be present in "project-directory/OpenGL/dll/" | |
add_custom_target(glutdlllib | |
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/OpenGL/dll/glut32.dll ${CMAKE_BINARY_DIR} | |
) | |
# required .lib files to be copied into compiler's proper directory | |
set(OpenGlLibs glaux glu32 glui32 glut32 opengl32) | |
add_executable(ProjectName main.cpp) | |
target_link_libraries(ProjectName ${OpenGlLibs}) | |
add_dependencies(ProjectName glutdlllib) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment