-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
36 lines (29 loc) · 945 Bytes
/
CMakeLists.txt
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
set(project_name "opengl_test")
cmake_minimum_required(VERSION 3.15)
project(${project_name})
set(CMAKE_CXX_STANDARD 14)
# 添加头文件
set(GLEW_H /usr/local/Cellar/glew/2.1.0/include)
set(GLFW_H /usr/local/Cellar/glfw/3.3.2/include)
#set(GLAD_H /usr/local/include/glad)
#set(KH_H /usr/local/include/KHR)
set(INCLUDE_H /usr/local/include)
include_directories(${GLEW_H} ${GLFW_H} ${INCLUDE_H})
#
# 添加目标链接
set(GLEW_LINK /usr/local/Cellar/glew/2.1.0/lib/libGLEW.2.1.dylib)
set(GLFW_LINK /usr/local/Cellar/glfw/3.3.2/lib/libglfw.3.dylib)
link_libraries(${OPENGL} ${GLEW_LINK} ${GLFW_LINK})
FILE(GLOB files
"cpp/*.h"
"cpp/*.cpp"
"cpp/*.c"
"cpp/util/*.h"
"cpp/util/*.cpp"
)
add_executable(${project_name} ${files})
# mac下这步很重要
if (APPLE)
target_link_libraries(${project_name} "-framework OpenGL")
target_link_libraries(${project_name} "-framework GLUT")
endif()