-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
81 lines (63 loc) · 1.9 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
# SpaceShooter CMakeLists.txt
# Copyright (C) 2011 Alessandro Ghedini <al3xbio@gmail.com>
# This file is released under the 3 clause BSD license, see COPYING
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
PROJECT(spaceshooter C)
SET(VERSION_MAJOR 2)
SET(VERSION_MINOR 9)
SET(INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
SET(DATA_PREFIX ${INSTALL_PREFIX}/share/games/spaceshooter)
CONFIGURE_FILE(
${PROJECT_SOURCE_DIR}/src/config.h.in
${PROJECT_BINARY_DIR}/src/config.h
)
INCLUDE(FindPkgConfig)
INCLUDE(CheckIncludeFiles)
PKG_CHECK_MODULES(GLFW libglfw REQUIRED)
PKG_CHECK_MODULES(SNDFILE sndfile REQUIRED)
PKG_CHECK_MODULES(OPENAL openal REQUIRED)
PKG_CHECK_MODULES(FREETYPE freetype2 REQUIRED)
FILE(GLOB SOURCES RELATIVE ${CMAKE_SOURCE_DIR} "src/*.c")
ADD_EXECUTABLE(spaceshooter ${SOURCES})
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_BINARY_DIR}/src
${GLFW_INCLUDE_DIRS}
${SNDFILE_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIRS}
${FREETYPE_INCLUDE_DIRS}
)
TARGET_LINK_LIBRARIES(
spaceshooter
${GLFW_LIBRARIES}
${SNDFILE_LIBRARIES}
${OPENAL_LIBRARIES}
${FREETYPE_LIBRARIES}
)
SET_TARGET_PROPERTIES(spaceshooter PROPERTIES
COMPILE_FLAGS "-Wall -pedantic -O3 -funroll-loops -ffast-math"
)
INSTALL(TARGETS spaceshooter
DESTINATION ${CMAKE_INSTALL_PREFIX}/games
)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/man/spaceshooter.6
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man6
)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/spaceshooter.desktop
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications
)
INSTALL(FILES
${PROJECT_SOURCE_DIR}/data/spaceshooter.xpm
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/pixmaps
)
INSTALL(DIRECTORY data/graphics DESTINATION ${DATA_PREFIX})
INSTALL(DIRECTORY data/sounds DESTINATION ${DATA_PREFIX})
CONFIGURE_FILE(
${CMAKE_CURRENT_SOURCE_DIR}/CMakeUninst.txt.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeUninst.txt
IMMEDIATE @ONLY
)
ADD_CUSTOM_TARGET(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/CMakeUninst.txt
)