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
|
From: Julian Ospald <hasufell@gentoo.org>
Date: Thu Aug 2 21:27:25 UTC 2012
Subject: build system
add install rule for cockatrice binary
make paths for ICONDIR and DESKTOPDIR modifiable
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -8,7 +8,9 @@
add_subdirectory(oracle)
endif(NOT WITHOUT_CLIENT)
+set(DATADIR "share/cockatrice" CACHE PATH "Data dir")
+
FILE(GLOB sounds "${CMAKE_CURRENT_SOURCE_DIR}/sounds/*.raw")
-INSTALL(FILES ${sounds} DESTINATION share/cockatrice/sounds)
+INSTALL(FILES ${sounds} DESTINATION ${DATADIR}/sounds)
FILE(GLOB zonebg "${CMAKE_CURRENT_SOURCE_DIR}/zonebg/*.*")
-INSTALL(FILES ${zonebg} DESTINATION share/cockatrice/zonebg)
\ No newline at end of file
+INSTALL(FILES ${zonebg} DESTINATION ${DATADIR}/zonebg)
--- servatrice/CMakeLists.txt
+++ servatrice/CMakeLists.txt
@@ -2,6 +2,9 @@
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
PROJECT(servatrice)
+# cmake modules
+include(GNUInstallDirs)
+
SET(servatrice_SOURCES
src/main.cpp
src/passwordhasher.cpp
@@ -51,3 +54,5 @@
COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/../common/getversion.cmake
)
+# install rules
+INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/servatrice DESTINATION ${CMAKE_INSTALL_BINDIR})
--- cockatrice/CMakeLists.txt
+++ cockatrice/CMakeLists.txt
@@ -158,7 +158,13 @@
)
if (UNIX AND NOT APPLE)
- set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${CMAKE_INSTALL_PREFIX}/share/cockatrice/translations\\")
+ if(IS_ABSOLUTE ${DATADIR})
+ set(_DATADIR ${DATADIR})
+ else()
+ set(_DATADIR ${CMAKE_INSTALL_PREFIX}/${DATADIR})
+ endif()
+
+ set_source_files_properties(src/main.cpp PROPERTIES COMPILE_FLAGS -DTRANSLATION_PATH=\\"${_DATADIR}/translations\\")
endif (UNIX AND NOT APPLE)
set(cockatrice_RESOURCES cockatrice.qrc)
@@ -201,6 +207,11 @@
set(CMAKE_CXX_FLAGS_DEBUG "-ggdb -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-s -O2")
+# paths
+set(ICONDIR share/icons CACHE STRING "icon dir")
+set(DESKTOPDIR share/applications CACHE STRING "desktop file destination")
+
+
QT4_WRAP_CPP(cockatrice_HEADERS_MOC ${cockatrice_HEADERS})
QT4_ADD_TRANSLATION(cockatrice_QM ${cockatrice_TS})
QT4_ADD_RESOURCES(cockatrice_RESOURCES_RCC ${cockatrice_RESOURCES})
@@ -218,10 +229,10 @@
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cockatrice DESTINATION bin)
if (NOT WIN32 AND NOT APPLE)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.png DESTINATION share/icons/hicolor/48x48/apps)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.svg DESTINATION share/icons/hicolor/scalable/apps)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cockatrice.desktop DESTINATION share/applications)
- INSTALL(FILES ${cockatrice_QM} DESTINATION share/cockatrice/translations)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.png DESTINATION ${ICONDIR}/hicolor/48x48/apps)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/resources/cockatrice.svg DESTINATION ${ICONDIR}/hicolor/scalable/apps)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/cockatrice.desktop DESTINATION ${DESKTOPDIR})
+ INSTALL(FILES ${cockatrice_QM} DESTINATION ${DATADIR}/translations)
ENDIF(NOT WIN32 AND NOT APPLE)
add_custom_command(
--- oracle/CMakeLists.txt
+++ oracle/CMakeLists.txt
@@ -1,6 +1,9 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(oracle)
+# paths
+set(DESKTOPDIR share/appliactions CACHE STRING "path to .desktop files")
+
SET(oracle_SOURCES src/main.cpp src/oracleimporter.cpp src/window_main.cpp ../cockatrice/src/carddatabase.cpp ../cockatrice/src/settingscache.cpp)
SET(oracle_HEADERS src/oracleimporter.h src/window_main.h ../cockatrice/src/carddatabase.h ../cockatrice/src/settingscache.h)
@@ -21,5 +24,5 @@
INSTALL(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/oracle DESTINATION bin)
IF (NOT WIN32 AND NOT APPLE)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION share/applications)
+ INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/oracle.desktop DESTINATION ${DESKTOPDIR})
ENDIF (NOT WIN32 AND NOT APPLE)
|