-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
66 lines (49 loc) · 1.89 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
project(glpp)
cmake_minimum_required(VERSION 2.8.5)
# put our custom modules into cmake's search path
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules)
# options
option(BUILD_EXAMPLES "Build glpp examples." ON)
option(FORCE_CXX11 "Force C++11 standard." OFF)
# find dependencies
include(MacroLogFeature)
include(GNUInstallDirs)
find_package(OpenGL)
macro_log_feature(OPENGL_FOUND "OpenGL" "Required to build glpp" "http://www.opengl.org" TRUE)
find_package(GLUT)
macro_log_feature(GLUT_FOUND "FreeGLUT" "Required to build glpp" "http://freeglut.sourceforge.net/" TRUE)
find_package(GLEW)
macro_log_feature(GLEW_FOUND "GLEW" "Required to build glpp" "http://glew.sourceforge.net/" TRUE)
find_package(GLM)
macro_log_feature(GLM_FOUND "GLM" "Required to build examples" "http://glm.g-truc.net/" FALSE)
find_package(FreeImage)
macro_log_feature(FREEIMAGE_FOUND "FreeImage" "Required for the examples" "http://freeimage.sourceforge.net/" FALSE)
find_package(Boost)
macro_log_feature(Boost_FOUND "Boost" "Required for the examples" "http://www.boost.org/" FALSE)
find_package(Assimp)
macro_log_feature(ASSIMP_FOUND "Assimp" "Required for the examples" "http://assimp.sourceforge.net/" FALSE)
# common flags for all the project
if (CMAKE_COMPILER_IS_GNUCXX)
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE CXX_VERSION)
if (CXX_VERSION VERSION_GREATER 4.6 OR CXX_VERSION VERSION_EQUAL 4.6)
message(STATUS "GCC Version >= 4.6, enabling C++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
endif()
endif()
if (FORCE_CXX11)
add_definitions(-DGLPP_FORCE_CXX11)
endif()
if(NOT WIN32)
add_definitions(-fPIC)
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/src
${OPENGL_INCLUDE_DIR}
${GLUT_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
)
add_subdirectory(src)
if (BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
macro_display_feature_log()