summaryrefslogtreecommitdiff
blob: 4825b341e64608c82ed41df296f78fec0a0c302e (plain)
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
From: Julian Ospald <hasufell@gentoo.org>
Date: Sun May 27 18:28:48 UTC 2012
Subject: build system

make paths modifiable
respect LDFLAGs

--- CMakeLists.txt
+++ CMakeLists.txt
@@ -30,6 +30,13 @@
 cmake_minimum_required(VERSION 2.6)
 set(WARGUS_VERSION 2.2.6)
 
+########### PATH OPTIONS ###############
+set(BINDIR "bin" CACHE PATH "Where to install binaries")
+set(SHAREDIR "share/games/stratagus/wargus" CACHE PATH "Where to install data files")
+set(DATAROOTDIR "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH "Sets the root of data directories to a non-default location")
+set(ICONDIR "${DATAROOTDIR}/pixmaps" CACHE PATH "Sets the icon directory for desktop entry to a non-default location.")
+set(DESKTOPDIR "${DATAROOTDIR}/applications" CACHE PATH "Sets the desktop file directory for desktop entry to a non-default location.")
+
 # Wargus sources
 
 set(pudconvert_SRCS
@@ -154,8 +161,13 @@
 endif()
 
 if (NOT WIN32 AND NOT MAEMO)
-	add_definitions(-DDATA_PATH="${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus")
-	add_definitions(-DSCRIPTS_PATH="${CMAKE_INSTALL_PREFIX}/share/games/stratagus/wargus")
+	if(NOT IS_ABSOLUTE "${SHAREDIR}")
+		set(var "${CMAKE_INSTALL_PREFIX}/${SHAREDIR}")
+	else()
+		set(var "${SHAREDIR}")
+	endif()
+	add_definitions(-DDATA_PATH="${var}")
+	add_definitions(-DSCRIPTS_PATH="${var}")
 	add_definitions(-DSTRATAGUS_BIN="${STRATAGUS}")
 endif()
 
@@ -169,9 +181,7 @@
 endif()
 
 if(ENABLE_STRIP)
-	set(CMAKE_EXE_LINKER_FLAGS "-s")
-else()
-	set(CMAKE_EXE_LINKER_FLAGS "")
+	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s")
 endif()
 
 # Compile Wargus
@@ -232,16 +242,16 @@
 
 ########### install files ###############
 
-install(TARGETS wargus DESTINATION games)
-install(TARGETS pudconvert wartool DESTINATION bin)
-install(FILES wargus.png DESTINATION share/pixmaps)
-install(FILES wargus.desktop DESTINATION share/applications)
-
-install(DIRECTORY campaigns maps scripts DESTINATION share/games/stratagus/wargus)
-install(FILES contrib/red_cross.png DESTINATION share/games/stratagus/wargus/graphics/missiles)
-install(FILES contrib/cross.png DESTINATION share/games/stratagus/wargus/graphics/ui/cursors)
-install(FILES contrib/food.png contrib/health.png contrib/health2.png contrib/mana.png contrib/mana2.png contrib/ore,stone,coal.png contrib/score.png DESTINATION share/games/stratagus/wargus/graphics/ui)
+install(TARGETS wargus DESTINATION ${BINDIR})
+install(TARGETS pudconvert wartool DESTINATION ${BINDIR})
+install(FILES wargus.png DESTINATION ${ICONDIR})
+install(FILES wargus.desktop DESTINATION ${DESKTOPDIR})
+
+install(DIRECTORY campaigns maps scripts DESTINATION ${SHAREDIR})
+install(FILES contrib/red_cross.png DESTINATION ${SHAREDIR}/graphics/missiles)
+install(FILES contrib/cross.png DESTINATION ${SHAREDIR}/graphics/ui/cursors)
+install(FILES contrib/food.png contrib/health.png contrib/health2.png contrib/mana.png contrib/mana2.png contrib/ore,stone,coal.png contrib/score.png DESTINATION ${SHAREDIR}/graphics/ui)
 
 if(MAEMO)
-	install(TARGETS warextract DESTINATION bin)
+	install(TARGETS warextract DESTINATION ${BINDIR})
 endif()