-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
49 lines (38 loc) · 1.26 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
cmake_minimum_required(VERSION 3.15)
project(opengl-basic)
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(CMAKE_CXX_STANDARD 14)
file(GLOB_RECURSE SOURCE_FILES
inc/*.c
inc/*.h
inc/*.hpp
src/*.cc
src/main.cpp
src/*.h)
add_executable(opengl-basic ${SOURCE_FILES})
# specify the search location
set( _glfw3_HEADER_SEARCH_DIRS "/usr/local/include")
set( _glfw3_LIB_SEARCH_DIRS "/usr/local/lib")
set( glm_dirs "./glm")
set( _glfw3_ENV_ROOT $ENV{GLFW3_ROOT} )
if( NOT GLFW3_ROOT AND _glfw3_ENV_ROOT )
set(GLFW3_ROOT ${_glfw3_ENV_ROOT} )
endif()
# Put user specified location at beginning of search
if( GLFW3_ROOT )
list( INSERT _glfw3_HEADER_SEARCH_DIRS 0 "${GLFW3_ROOT}/include" )
list( INSERT _glfw3_LIB_SEARCH_DIRS 0 "${GLFW3_ROOT}/lib" )
endif()
# Search for the header
FIND_PATH(GLFW3_INCLUDE_DIR "GLFW/glfw3.h" PATHS ${_glfw3_HEADER_SEARCH_DIRS})
# Search for the library
FIND_LIBRARY(GLFW3_LIBRARY NAMES libglfw.3.4.dylib PATHS ${_glfw3_LIB_SEARCH_DIRS})
#include header file directory
include_directories(${GLFW3_INCLUDE_DIR})
include_directories(${glm_dirs})
include_directories("./")
#include library file directory
link_directories(${_glfw3_LIB_SEARCH_DIRS})
#link library file
target_link_libraries(opengl-basic ${GLFW3_LIBRARY})