1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| cmake_minimum_required(VERSION 3.17)
project(OpenglDemo)
set(CMAKE_CXX_STANDARD 14)
if (NOT DEFINED ENV{GLFW_HOME}) message(FATAL_ERROR "found no env named GLFW_HOME") endif() if (NOT DEFINED ENV{GLAD_HOME}) message(FATAL_ERROR "found no env named GLAD_HOME") endif()
set(GLFW_HOME $ENV{GLFW_HOME}) set(GLAD_HOME $ENV{GLAD_HOME})
include_directories("${GLFW_HOME}/include") include_directories("${GLAD_HOME}/include")
add_library(glfw SHARED IMPORTED) SET_TARGET_PROPERTIES( glfw PROPERTIES IMPORTED_LOCATION "${GLFW_HOME}/lib/libglfw.3.3.dylib" )
add_executable(OpenglDemo main.cpp "lib/glad.c")
target_link_libraries(OpenglDemo glfw "-framework OpenGL")
|