-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
104 lines (81 loc) · 2.35 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
104
# Copyright (c) 2013 Thanh Ha
#
# This file is part of sdl-tictactoe.
#
# sdl-tictactoe is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# sdl-tictactoe is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with sdl-tictactoe. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required (VERSION 2.6 FATAL_ERROR)
set (App_Name "sdl-tictactoe")
if (App_Name STREQUAL "")
message(FATAL_ERROR "You must set an App Name")
endif()
project (${App_Name})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
###
### Find Application Sources
###
file (GLOB SRCS src/*.c src/*.cpp)
file (GLOB HDRS src/*.h src/*.hpp)
link_directories(
)
include_directories(
${CMAKE_SOURCE_DIR}/include
)
if(WIN32)
add_executable(${App_Name} WIN32
${SRCS}
${HDRS}
)
SET_TARGET_PROPERTIES(${App_Name} PROPERTIES COMPILE_FLAGS "")
SET_TARGET_PROPERTIES(${App_Name} PROPERTIES LINK_FLAGS "-lmingw32 -mwindows")
else ()
add_executable (${App_Name}
${SRCS}
${HDRS}
)
endif ()
target_link_libraries(${App_Name}
)
###
### Find SDL2
###
find_package(SDL2)
if (NOT SDL2_FOUND)
message (FATAL_ERROR "SDL not found!")
endif (NOT SDL2_FOUND)
find_package(SDL2_image)
if (NOT SDL2IMAGE_FOUND)
message (FATAL_ERROR "SDL_image not found!")
endif (NOT SDL2IMAGE_FOUND)
###
### Find Boost
###
find_package( Boost COMPONENTS program_options REQUIRED )
if (NOT Boost_FOUND)
message (FATAL_ERROR "Boost not found!")
endif (NOT Boost_FOUND)
include_directories(
${Boost_INCLUDE_DIR}
${SDL2_INCLUDE_DIR}
${INCLUDE_DIRECTORIES}
)
target_link_libraries(${App_Name}
${Boost_LIBRARIES}
${SDL2_LIBRARY}
${SDL2MAIN_LIBRARY}
${SDL2IMAGE_LIBRARY}
${TARGET_LINK_LIBRARIES}
)
## Copy graphics to output
file(COPY "${CMAKE_SOURCE_DIR}/gfx" DESTINATION "${CMAKE_BINARY_DIR}"
PATTERN "gfx/*.xcf" EXCLUDE)