forked from Sentmoraap/doing-sdl-right
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (49 loc) · 1.69 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
## CMakeLists.txt
##
##
# Define the following vars in your CMakeCache.txt file(s)
cmake_minimum_required(VERSION 2.6)
PROJECT(doing-sdl-right)
IF(NOT WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -pedantic")
ELSE(NOT WIN32)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D _CRT_SECURE_NO_WARNINGS /D NOMINMAX")
ENDIF(NOT WIN32)
FILE(
GLOB_RECURSE
project_files
src/*
)
ADD_EXECUTABLE(sdl-test ${project_files})
SET(CURRENT_TARGETS sdl-test)
IF(WIN32)
SET(CMAKE_INCLUDE_PATH "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include")
SET(CMAKE_LIBRARY_PATH "C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/lib")
ENDIF(WIN32)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
SET(OpenGL_GL_PREFERENCE GLVND)
FIND_PACKAGE(OpenGL REQUIRED)
FIND_PACKAGE(GLEW REQUIRED)
FIND_PACKAGE(SDL2 REQUIRED)
FIND_PACKAGE(SDL2_image REQUIRED)
FOREACH(CURRENT_TARGET ${CURRENT_TARGETS})
IF(GLEW_FOUND)
TARGET_LINK_LIBRARIES(${CURRENT_TARGET} ${GLEW_LIBRARIES})
ENDIF (GLEW_FOUND)
IF(OpenGL_FOUND)
TARGET_LINK_LIBRARIES(${CURRENT_TARGET} ${OPENGL_LIBRARIES})
ENDIF (OpenGL_FOUND)
IF(SDL2_FOUND)
TARGET_LINK_LIBRARIES(${CURRENT_TARGET} ${SDL2_LIBRARIES})
ENDIF(SDL2_FOUND)
IF(SDL2_IMAGE_FOUND)
TARGET_LINK_LIBRARIES(${CURRENT_TARGET} ${SDL2_IMAGE_LIBRARIES})
ENDIF(SDL2_IMAGE_FOUND)
SET_PROPERTY(TARGET ${CURRENT_TARGET} PROPERTY INCLUDE_DIRECTORIES
${CMAKE_SOURCE_DIR}/include/
${OpenGL_INCLUDE_DIR}
${GLEW_INCLUDE_DIR}
${SDL_INCLUDE_DIR}
${SDL2_IMAGE_INCLUDE_DIR}
)
ENDFOREACH(CURRENT_TARGET)