generated from nobuyuki83/Applied_Computer_Graphics_2022S
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
60 lines (47 loc) · 1.42 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.12)
#############################
# set C++ detail
enable_language(CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
IF(MSVC)
set(CMAKE_CXX_FLAGS "/W4")
ELSE()
set(CMAKE_CXX_FLAGS "-Wall -Wextra -g")
ENDIF()
#############################
# set project name
project(task02)
# define a macro to get absolute path in C++
add_definitions(-DSOURCE_DIR="${PROJECT_SOURCE_DIR}")
#############################
# specifying libraries to use
# use opengl
find_package(OpenGL REQUIRED)
# use glfw
set(CMAKE_PREFIX_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../external/glfwlib)
find_package(glfw3 REQUIRED)
########################
# include, build, & link
include_directories(${PROJECT_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/../external
${CMAKE_CURRENT_SOURCE_DIR}/../external/delfem2/include
${CMAKE_CURRENT_SOURCE_DIR}/../external/glad3/include
)
add_executable(${PROJECT_NAME}
# main_ans.cpp
main.cpp
${CMAKE_CURRENT_SOURCE_DIR}/../external/glad3/include/glad/glad.h
${CMAKE_CURRENT_SOURCE_DIR}/../external/glad3/src/glad.c
)
# https://stackoverflow.com/questions/33678965/need-to-link-cmake-project-to-dl-library
target_link_libraries(${PROJECT_NAME}
OpenGL::GL
glfw
${CMAKE_DL_LIBS}
)
#############################
# showing status of libraries
GET_TARGET_PROPERTY(GLFW_INCLUDE_DIR
glfw INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "task02 glfw include directory: ${GLFW_INCLUDE_DIR}")