-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
67 lines (55 loc) · 2.02 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
# Some functions require a certain version of cmake (for example file GLOB )
cmake_minimum_required(VERSION 2.8)
# Create the project
set(PROJECT_NAME curlnoise)
project(${PROJECT_NAME})
# Add the external module path
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
# Add the SGE subdirectory
add_subdirectory(${PROJECT_SOURCE_DIR}/ext/SimpleGraphicsEngine)
# Find external packages
find_package(OPENGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(GLFW3 REQUIRED)
find_package(ANTTWEAKBAR REQUIRED)
find_package(GLM REQUIRED)
if(APPLE)
find_library(OPENGL_FRAMEWORK OpenGL)
find_library(COCOA_FRAMEWORK Cocoa)
endif(APPLE)
# Add include directories
include_directories(${GLEW_INCLUDE_DIR})
include_directories(${GLFW_INCLUDE_DIRS})
include_directories(${ANT_TWEAK_BAR_INCLUDE_PATH})
include_directories(${GLM_INCLUDE_DIR})
include_directories(${SGE_INCLUDE_DIRS})
# Our own include directory
set(COMMON_INCLUDES ${PROJECT_SOURCE_DIR}/include)
include_directories(${COMMON_INCLUDES})
# Debugger flag
set(CMAKE_CXX_FLAGS "-g")
# Creating our own CURL_NOISE library
file(GLOB CURL_NOISE_lib_SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
file(GLOB CURL_NOISE_lib_HEADERS ${PROJECT_SOURCE_DIR}/include/*.h)
# We do not want main.cpp in the library
file(GLOB to_remove ${PROJECT_SOURCE_DIR}/src/main.cpp)
list(REMOVE_ITEM CURL_NOISE_lib_SOURCES ${to_remove})
list(REMOVE_ITEM CURL_NOISE_lib_HEADERS ${to_remove})
add_library(${PROJECT_NAME}_lib ${CURL_NOISE_lib_SOURCES} ${CURL_NOISE_lib_HEADERS})
# Create the executable
add_executable(${PROJECT_NAME} src/main.cpp)
# C++11 compatability
set_target_properties(${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "-std=c++11")
# Link all the libraries (including our own)
target_link_libraries(${PROJECT_NAME}
${PROJECT_NAME}_lib
SGE
${OPENGL_LIBRARIES}
${OPENGL_glu_LIBRARY}
${GLEW_LIBRARIES}
${GLFW_LIBRARIES}
${ANT_TWEAK_BAR_LIBRARY})
# OpenGL library (only for osx)
if(APPLE)
target_link_libraries(${PROJECT_NAME} ${OPENGL_FRAMEWORK} ${COCOA_FRAMEWORK})
endif(APPLE)