-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
executable file
·103 lines (86 loc) · 2.09 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
cmake_minimum_required (VERSION 2.6)
project (trees)
# all the .cpp files that make up this project
add_executable(trees
main.cpp
glCanvas.cpp
camera.cpp
matrix.cpp
edge.cpp
mesh.cpp
argparser.h
camera.h
edge.h
glCanvas.h
hash.h
matrix.h
MersenneTwister.h
mesh.h
triangle.h
vectors.h
vertex.h
hit.h
ray.h
material.cpp
material.h
image.cpp
image.h
view.cpp
view.h
triangle.cpp
forest.h
forest.cpp
hemisphere.h
hemisphere.cpp
seeder.h
seeder.cpp
terraingenerator.h
terraingenerator.cpp
)
# platform specific compiler flags to output all compiler warnings
if (UNIX)
if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
set_target_properties (trees PROPERTIES COMPILE_FLAGS "-g -Wall -pedantic -DFreeBSD")
else()
set_target_properties (trees PROPERTIES COMPILE_FLAGS "-g -Wall -pedantic -std=c++0x")
endif()
endif()
if (APPLE)
set_target_properties (trees PROPERTIES COMPILE_FLAGS "-g -Wall -pedantic")
endif()
if (WIN32)
set_target_properties (trees PROPERTIES COMPILE_FLAGS "/W4")
endif()
# a work-around function to handle a list of libraries that include a
# NOTFOUND library
function (add_lib_list target liblist)
foreach (lib ${liblist})
if (lib)
target_link_libraries(${target} "${lib}")
else()
message(STATUS "WARNING: missing library: ${lib}")
endif()
endforeach()
endfunction()
# search for the GL & GLUT & GLEW libraries
find_package(GLUT)
if (NOT GLUT_FOUND)
message(FATAL_ERROR "Cannot find GLUT library")
endif()
message(STATUS "Found GLUT at \"${GLUT_LIBRARIES}\"")
find_package(OpenGL)
if (NOT OPENGL_FOUND)
message(FATAL_ERROR "Cannot find OpenGL library")
endif()
message(STATUS "Found OpenGL at \"${OPENGL_LIBRARIES}\"")
add_lib_list(trees "${OPENGL_LIBRARIES}")
add_lib_list(trees "${GLUT_LIBRARIES}")
if (WIN32)
find_library(GLEW_LIBRARIES glew32 HINT "lib")
if (NOT GLEW_LIBRARIES)
message(FATAL_ERROR "Cannot find GLEW library")
endif()
message(STATUS "Found GLEW at \"${GLEW_LIBRARIES}\"")
add_lib_list(trees "${GLEW_LIBRARIES}")
endif()
#include_directories(".")