author | Myhailo Danylenko <isbear@ukrpost.net> |
Thu, 13 Nov 2014 02:32:29 +0200 | |
changeset 36 | 57b2c4f84169 |
parent 34 | 5b818c7467ad |
child 37 | ed1b8250a170 |
permissions | -rw-r--r-- |
0 | 1 |
## Copyright 2009 Myhailo Danylenko |
2 |
# This file is part of mcabber module writing howto examples. |
|
3 |
# |
|
4 |
# Examples are free software: you can redistribute it and/or modify |
|
5 |
# it under the terms of the GNU General Public License as published by |
|
6 |
# the Free Software Foundation, either version 2 of the License, or |
|
7 |
# (at your option) any later version. |
|
8 |
# |
|
9 |
# This program is distributed in the hope that it will be useful, |
|
10 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
# GNU General Public License for more details. |
|
13 |
# |
|
14 |
# You should have received a copy of the GNU General Public License |
|
15 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
||
17 |
cmake_minimum_required(VERSION 2.6) |
|
18 |
project(cmd C) |
|
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
19 |
set(PROJECT_VERSION "0.0.1") |
0 | 20 |
|
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
21 |
## User settable options |
34
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
22 |
set(OPT_CMD_HEADER "cmd_header" CACHE STRING "Name for mcabber option to enable/disable header with command line") |
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
23 |
set(OPT_CMD_HEADER_INLINE "cmd_header_inline" CACHE STRING "Name for mcabber option to switch between headline/inline header") |
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
24 |
set(OPT_CMD_REDIRECT_STDERR "cmd_redirect_stderr" CACHE STRING "Name for mcabber option to enable stderr capturing") |
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
25 |
set(OPT_CMD_SHELL "cmd_shell" CACHE STRING "Name for mcabber option to specify shell to be used to execute command") |
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
26 |
|
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
27 |
## Check for build dependencies |
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
28 |
find_package(PkgConfig REQUIRED) |
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
29 |
pkg_check_modules(GLIB REQUIRED glib-2.0) |
13
88315b883803
Use pkg-config to detect mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
30 |
pkg_check_modules(MCABBER REQUIRED mcabber) |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
31 |
link_directories(${GLIB_LIBRARY_DIRS} |
13
88315b883803
Use pkg-config to detect mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
32 |
${MCABBER_LIBRARY_DIRS}) |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
33 |
|
0 | 34 |
## Target definitions |
35 |
add_library(cmd MODULE cmd.c) |
|
36 |
||
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
37 |
## Compiler setup |
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
38 |
configure_file(config.h.in config.h) |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
39 |
include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} |
13
88315b883803
Use pkg-config to detect mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
40 |
${MCABBER_INCLUDE_DIRS}) |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
41 |
target_link_libraries(cmd ${GLIB_LIBRARIES} |
13
88315b883803
Use pkg-config to detect mcabber headers
Myhailo Danylenko <isbear@ukrpost.net>
parents:
12
diff
changeset
|
42 |
${MCABBER_LIBRARIES}) |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
43 |
include_directories(${cmd_SOURCE_DIR} |
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
44 |
${cmd_BINARY_DIR}) |
18
887d772326a0
Fix compilation warnings
Myhailo Danylenko <isbear@ukrpost.net>
parents:
16
diff
changeset
|
45 |
set_target_properties(cmd PROPERTIES COMPILE_FLAGS "-Wall") |
10
aaaa2b1a8de0
Fix linker library search path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
9
diff
changeset
|
46 |
|
0 | 47 |
## Packaging information |
34
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
48 |
set(CPACK_PACKAGE_NAME mcabber-mod-cmd) |
16
19d13d97b3a1
Use new module struct with api
Myhailo Danylenko <isbear@ukrpost.net>
parents:
15
diff
changeset
|
49 |
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
0 | 50 |
set(CPACK_PACKAGE_VENDOR "IsBear") |
51 |
set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>") |
|
34
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
52 |
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Mcabber module for sending shell command output to buddies") |
0 | 53 |
set(CPACK_RESOURCE_FILE_LICENSE ${cmd_SOURCE_DIR}/COPYING) |
54 |
set(CPACK_SOURCE_GENERATOR TBZ2) |
|
34
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
55 |
set(CPACK_GENERATOR DEB CACHE STRING "Binary package generator, eg DEB, RPM, TGZ, NSIS...") |
0 | 56 |
set(CPACK_DEBIAN_PACKAGE_SECTION libs) |
57 |
find_program(DPKG_EXECUTABLE dpkg) |
|
58 |
if(DPKG_EXECUTABLE) |
|
59 |
execute_process(COMMAND ${DPKG_EXECUTABLE} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE) |
|
60 |
else() |
|
34
5b818c7467ad
Make option names configurable, deb naming scheme change
Myhailo Danylenko <isbear@ukrpost.net>
parents:
32
diff
changeset
|
61 |
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386 CACHE STRING "Architecture of package") |
0 | 62 |
endif() |
63 |
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") |
|
64 |
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so") |
|
65 |
include(CPack) |
|
66 |
||
25
8020f3f6ad4f
Add AVV module description
Myhailo Danylenko <isbear@ukrpost.net>
parents:
18
diff
changeset
|
67 |
configure_file(cmd.avv.in cmd.avv) |
8020f3f6ad4f
Add AVV module description
Myhailo Danylenko <isbear@ukrpost.net>
parents:
18
diff
changeset
|
68 |
|
12
bc6d4169afdb
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
11
diff
changeset
|
69 |
## Installation |
bc6d4169afdb
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
11
diff
changeset
|
70 |
install(TARGETS cmd DESTINATION lib/mcabber) |
32 | 71 |
install(FILES docs/cmd.rc COPYING docs/readme.mdwn docs/todo.mdwn DESTINATION share/doc/${CPACK_PACKAGE_NAME}) |
12
bc6d4169afdb
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
11
diff
changeset
|
72 |
install(DIRECTORY help DESTINATION share/mcabber) |
25
8020f3f6ad4f
Add AVV module description
Myhailo Danylenko <isbear@ukrpost.net>
parents:
18
diff
changeset
|
73 |
install(FILES ${PROJECT_BINARY_DIR}/cmd.avv DESTINATION share/mcabber/avv/modules RENAME cmd) |
12
bc6d4169afdb
Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents:
11
diff
changeset
|
74 |
|
0 | 75 |
## The End ## vim: se ts=4: ## |