-
Notifications
You must be signed in to change notification settings - Fork 34
/
CMakeLists.txt
50 lines (38 loc) · 1.41 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 2.8)
# Project details.
project(OpenGLExamples)
SET(${PROJECT_NAME}_MAJOR_VERSION 0)
SET(${PROJECT_NAME}_MINOR_VERSION 1)
SET(${PROJECT_NAME}_PATCH_LEVEL 0)
# Add local repository for FindXXX.cmake modules.
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake/Modules/" ${CMAKE_MODULE_PATH})
# Look for OpenGL.
find_package(OpenGL REQUIRED)
# Look for GLFW.
find_package(GLFW REQUIRED)
include_directories(${GLFW_INCLUDE_DIR})
# Look for GLEW.
find_package(GLEW REQUIRED)
include_directories(${GLEW_INCLUDE_DIR})
# Set necessary libs.
set(OPENGLEXAMPLES_REQUIRED_LIBS
${GLFW_LIBRARIES}
${GLEW_LIBRARIES}
${OPENGL_LIBRARY}
)
# Set binaries output folder.
SET(OPENGLEXAMPLES_OUTPUT_PATH_PREFIX "${PROJECT_BINARY_DIR}/Binaries")
SET(OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX "")
IF(${CMAKE_CFG_INTDIR} STREQUAL ".")
SET(OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX ${CMAKE_BUILD_TYPE})
IF(NOT OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX)
SET(OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX "Release")
ENDIF(NOT OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX)
ENDIF(${CMAKE_CFG_INTDIR} STREQUAL ".")
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${OPENGLEXAMPLES_OUTPUT_PATH_PREFIX}/${CMAKE_SYSTEM_NAME}/${OPENGLEXAMPLES_OUTPUT_PATH_SUFFIX}
CACHE STRING "Where binaries and shared lib files go" FORCE)
IF(MSVC)
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ENTRY:mainCRTStartup ")
ENDIF(MSVC)
# Add main target.
add_subdirectory(Examples)