-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathCMakeLists.txt
82 lines (61 loc) · 1.85 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
cmake_minimum_required(VERSION 2.8.11 FATAL_ERROR)
cmake_policy(VERSION 2.8.11)
project(glcapsviewer)
set(NAME glcapsviewer)
set(CMAKE_INCLUDE_CURRENT_DIR OFF)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-std=c++11)
add_definitions(-std=c++0x)
include_directories("." "GeneratedFiles")
file(GLOB SOURCE *.cpp)
file(GLOB HEADER *.h)
#Qt
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Widgets REQUIRED)
file (GLOB Resources *.qrc)
QT5_ADD_RESOURCES(ResourceSources ${Resources})
#Gl
find_package(OpenGL REQUIRED)
#Glew
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIR})
#Glfw
find_path(GLFW_INCLUDE_DIR GLFW/glfw3.h)
find_library(GLFW_LIBRARY NAMES glfw3 glfw)
IF(UNIX)
find_package(X11 REQUIRED)
link_libraries(${X11_LIBRARIES})
ENDIF(UNIX)
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
set(GLFW_LIBRARIES ${GLFW_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GLFW
REQUIRED_VARS GLFW_INCLUDE_DIR GLFW_LIBRARY)
if(GLFW_FOUND AND NOT TARGET GLFW::GLFW)
add_library(GLFW::GLFW UNKNOWN IMPORTED)
set_target_properties(GLFW::GLFW PROPERTIES
IMPORTED_LOCATION "${GLFW_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${GLFW_INCLUDE_DIRS}")
endif()
mark_as_advanced(GLFW_INCLUDE_DIR GLFW_LIBRARY)
# Compiler specific stuff
IF(MSVC)
SET(CMAKE_CXX_FLAGS "/EHsc")
ENDIF(MSVC)
# Unicode
add_definitions(-DUNICODE -D_UNICODE)
add_executable(${NAME} WIN32
${SOURCE}
${HEADER}
${ResourceSources})
target_link_libraries(${NAME} Qt5::Core)
target_link_libraries(${NAME} Qt5::Gui)
target_link_libraries(${NAME} Qt5::Network)
target_link_libraries(${NAME} Qt5::Widgets)
target_link_libraries(${NAME} GLEW::GLEW)
target_link_libraries(${NAME} ${OPENGL_LIBRARIES})
target_link_libraries(${NAME} ${GLFW_LIBRARY})