CMakeLists.txt
author Myhailo Danylenko <isbear@ukrpost.net>
Sat, 05 Mar 2016 15:43:04 +0200
changeset 59 19cfaceda6bb
parent 57 37ed3c7ac1b6
child 62 d92358eafead
permissions -rw-r--r--
ssl: Add ssl:ca_path and ssl:cipher_list methods (v0.9.4)
59
19cfaceda6bb ssl: Add ssl:ca_path and ssl:cipher_list methods (v0.9.4)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 57
diff changeset
     1
## Copyright 2009-2016 Myhailo Danylenko
20
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     2
# This file is part of lua-lm
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     3
#
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     4
# lua-lm is free software: you can redistribute it and/or modify
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     5
# it under the terms of the GNU General Public License as published by
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     6
# the Free Software Foundation, either version 2 of the License, or
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     7
# (at your option) any later version.
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     8
#
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
     9
# This program is distributed in the hope that it will be useful,
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    12
# GNU General Public License for more details.
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    13
#
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    14
# You should have received a copy of the GNU General Public License
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
    15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
2
34b6fedde9eb Switch to cmake
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    16
34b6fedde9eb Switch to cmake
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    17
cmake_minimum_required(VERSION 2.6)
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    18
project(lua-lm C)
59
19cfaceda6bb ssl: Add ssl:ca_path and ssl:cipher_list methods (v0.9.4)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 57
diff changeset
    19
set(PROJECT_VERSION "0.9.4")
2
34b6fedde9eb Switch to cmake
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    20
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    21
## User options
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    22
option(DEBUG      "Enable debugging output" OFF)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    23
option(WANT_LUA52 "Force Lua 5.2 usage"     OFF)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    24
set(TEST_USER        "test@jabber.org" CACHE STRING "Testing: Your jabber account name")
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    25
set(TEST_PASSWORD    "greatsecret" CACHE STRING "Testing: Password for your jabber account")
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    26
set(TEST_TO          "test@jabber.org/mcabber" CACHE STRING "Testing: Target jabber entity")
27
23393a00c2c1 Small typo and header fixes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 26
diff changeset
    27
set(TEST_FINGERPRINT "00:11:22:33:44:55:66:77:88:99:aa:bb:cc:dd:ee:ff" CACHE STRING "Testing: Your jabber server SSL fingerprint")
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    28
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    29
## Gather information about system
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    30
find_package(PkgConfig REQUIRED)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    31
if(NOT WANT_LUA52)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    32
	find_package(Lua51)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    33
endif()
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    34
if(WANT_LUA52 OR NOT LUA51_FOUND)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    35
	pkg_check_modules(LUA REQUIRED lua5.2)
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    36
	set(LUA_VERSION "5.2")
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    37
	set(HAVE_LUA52 "1")
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    38
else()
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    39
	set(LUA_VERSION "5.1")
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    40
	set(LUA_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    41
endif()
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    42
find_program(LUA_EXECUTABLE lua${LUA_VERSION} lua luanoreadline)
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    43
if(LUA_EXECUTABLE)
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    44
	execute_process(COMMAND ${LUA_EXECUTABLE} -e "print ( package.path )"  OUTPUT_VARIABLE LUA_PATH  OUTPUT_STRIP_TRAILING_WHITESPACE)
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    45
	execute_process(COMMAND ${LUA_EXECUTABLE} -e "print ( package.cpath )" OUTPUT_VARIABLE LUA_CPATH OUTPUT_STRIP_TRAILING_WHITESPACE)
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    46
endif()
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    47
pkg_check_modules(GLIB REQUIRED glib-2.0)
57
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    48
pkg_check_modules(LM loudmouth-1.0>=1.5.3)
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    49
if ( LM_FOUND )
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    50
	set(HAVE_LM_SHA256_FINGERPRINTS TRUE)
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    51
else()
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    52
	pkg_check_modules(LM REQUIRED loudmouth-1.0)
37ed3c7ac1b6 ssl: Support for SHA256 fingerprints (v0.9.3)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 56
diff changeset
    53
endif()
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    54
include(CheckFunctionExists)
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    55
set(CMAKE_REQUIRED_INCLUDES ${LM_INCLUDE_DIRS})
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    56
set(CMAKE_REQUIRED_LIBRARIES ${LM_LIBRARIES})
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    57
set(CMAKE_REQUIRED_FLAGS ${LM_LDFLAGS} ${LM_CFLAGS})
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    58
check_function_exists(lm_connection_get_keep_alive_rate HAVE_LM_CONNECTION_GET_KEEP_ALIVE_RATE)
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    59
check_function_exists(lm_connection_unregister_reply_handler HAVE_LM_CONNECTION_UNREGISTER_REPLY_HANDLER)
59
19cfaceda6bb ssl: Add ssl:ca_path and ssl:cipher_list methods (v0.9.4)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 57
diff changeset
    60
check_function_exists(lm_ssl_set_ca HAVE_LM_SSL_SET_CA)
19cfaceda6bb ssl: Add ssl:ca_path and ssl:cipher_list methods (v0.9.4)
Myhailo Danylenko <isbear@ukrpost.net>
parents: 57
diff changeset
    61
check_function_exists(lm_ssl_set_cipher_list HAVE_LM_SSL_SET_CIPHER_LIST)
47
4bf7ef2fea2e Put docgen into a separate package
Myhailo Danylenko <isbear@ukrpost.net>
parents: 44
diff changeset
    62
find_program(DOCGEN_EXECUTABLE NAMES docgen.pl docgen DOC "Docgen documentation generator script (optional)")
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    63
# (this should be before targets definitions)
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    64
link_directories(${LUA_LIBRARY_DIRS} ${GLIB_LIBRARY_DIRS} ${LM_LIBRARY_DIRS})
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    65
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    66
## Define targets
2
34b6fedde9eb Switch to cmake
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    67
add_library(loudmouth MODULE util.c lm_types.c lm_proxy.c lm_ssl.c lm_connection.c lm_message.c lm_message_node.c lm_message_handler.c lm.c)
44
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    68
get_target_property(loudmouth_SOURCES loudmouth SOURCES)
2
34b6fedde9eb Switch to cmake
Myhailo Danylenko <isbear@ukrpost.net>
parents:
diff changeset
    69
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    70
## Set up compiler
44
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    71
if(DEBUG)
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    72
	set(DEBUG_COMPILE_FLAGS "-g")
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    73
endif()
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    74
configure_file(config.h.in config.h)
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    75
include_directories(SYSTEM ${LUA_INCLUDE_DIRS} ${GLIB_INCLUDE_DIRS} ${LM_INCLUDE_DIRS})
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    76
target_link_libraries(loudmouth ${LUA_LIBRARIES} ${GLIB_LIBRARIES} ${LM_LIBRARIES})
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    77
include_directories(${lua-lm_SOURCE_DIR} ${lua-lm_BINARY_DIR})
44
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    78
set_target_properties(loudmouth PROPERTIES
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    79
                      PREFIX ""
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    80
                      COMPILE_FLAGS "-Wall ${DEBUG_COMPILE_FLAGS}")
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    81
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    82
## Extra targets
47
4bf7ef2fea2e Put docgen into a separate package
Myhailo Danylenko <isbear@ukrpost.net>
parents: 44
diff changeset
    83
if(DOCGEN_EXECUTABLE)
4bf7ef2fea2e Put docgen into a separate package
Myhailo Danylenko <isbear@ukrpost.net>
parents: 44
diff changeset
    84
	add_custom_command(OUTPUT ${lua-lm_BINARY_DIR}/loudmouth.html COMMAND ${DOCGEN_EXECUTABLE} -f html -t "Lua-loudmouth API reference" -o ${lua-lm_BINARY_DIR}/loudmouth.html -- ${loudmouth_SOURCES} DEPENDS ${DOCGEN_EXECUTABLE} ${loudmouth_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR})
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    85
	add_custom_target(doc ALL DEPENDS ${lua-lm_BINARY_DIR}/loudmouth.html)
48
ef69edc792be Rearrange docs
Myhailo Danylenko <isbear@ukrpost.net>
parents: 47
diff changeset
    86
	add_custom_command(OUTPUT ${lua-lm_SOURCE_DIR}/docs/api.mdwn COMMAND ${DOCGEN_EXECUTABLE} -f mdwn -t "Lua-loudmouth API reference" -o ${lua-lm_SOURCE_DIR}/docs/api.mdwn -- ${loudmouth_SOURCES} DEPENDS ${DOCGEN_EXECUTABLE} ${loudmouth_SOURCES} WORKING_DIRECTORY ${lua-lm_SOURCE_DIR})
ef69edc792be Rearrange docs
Myhailo Danylenko <isbear@ukrpost.net>
parents: 47
diff changeset
    87
	add_custom_target(update_api DEPENDS ${lua-lm_SOURCE_DIR}/docs/api.mdwn)
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    88
endif()
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    89
if(LUA_EXECUTABLE)
56
d53804c0fb6f cmake: Rename test target
Myhailo Danylenko <isbear@ukrpost.net>
parents: 55
diff changeset
    90
	add_custom_target(dotest COMMAND env "LUA_PATH=${lua-lm_SOURCE_DIR}/?.lua;${LUA_PATH}" "LUA_CPATH=${lua-lm_SOURCE_DIR}/?.so;${lua-lm_BINARY_DIR}/?.so;${LUA_CPATH}" "${LUA_EXECUTABLE}" "${lua-lm_SOURCE_DIR}/test.lua" "${TEST_USER}" "${TEST_PASSWORD}" "${TEST_TO}" "${TEST_FINGERPRINT}" DEPENDS loudmouth VERBATIM)
32
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    91
endif()
493d5d5198c8 Fix build system settings
Myhailo Danylenko <isbear@ukrpost.net>
parents: 31
diff changeset
    92
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    93
## Packaging information
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
    94
set(CPACK_PACKAGE_NAME lua${LUA_VERSION}-loudmouth)
44
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
    95
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    96
set(CPACK_PACKAGE_VENDOR "IsBear")
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    97
set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>")
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    98
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Loudmouth XMPP client library lua interface")
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
    99
set(CPACK_PACKAGE_DESCRIPTION_FILE ${lua-lm_SOURCE_DIR}/README)
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   100
set(CPACK_RESOURCE_FILE_LICENSE ${lua-lm_SOURCE_DIR}/COPYING)
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   101
set(CPACK_RESOURCE_FILE_README ${lua-lm_SOURCE_DIR}/README)
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   102
set(CPACK_RESOURCE_FILE_WELCOME ${lua-lm_SOURCE_DIR}/README)
28
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   103
set(CPACK_SOURCE_GENERATOR TBZ2)
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   104
set(CPACK_GENERATOR DEB CACHE STRING "Binary package generator, eg DEB, RPM, TGZ, NSIS...")
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   105
set(CPACK_DEBIAN_PACKAGE_SECTION libs)
20
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
   106
# XXX: tmp=`tempfile`; obj=${lua-lm_BINARY_DIR}/loudmouth.so; ldd $obj > $tmp; objdump -p $obj | \grep NEEDED | sed -e 's/.*NEEDED *//' | xargs -I "{}" grep -F "{}" $tmp | sed -e 's/.*=> *\(\S*\).*/\1/' | xargs dpkg -S | cut -d : -f 1 | sort -u ; \rm $tmp
0ce7093df25f Pre-publish changes
Myhailo Danylenko <isbear@ukrpost.net>
parents: 7
diff changeset
   107
# TODO: versions
55
25f8359ed8cf Fix debian dependencies
Myhailo Danylenko <isbear@ukrpost.net>
parents: 54
diff changeset
   108
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libglib2.0-0, liblua${LUA_VERSION}-0, libloudmouth1-0")
28
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   109
find_program(DPKG_EXECUTABLE dpkg)
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   110
if(DPKG_EXECUTABLE)
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   111
	execute_process(COMMAND ${DPKG_EXECUTABLE} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   112
else()
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   113
	set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386 CACHE STRING "Architecture of package")
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   114
endif()
2e4650583dd7 Debian-compliant package names
Myhailo Danylenko <isbear@ukrpost.net>
parents: 27
diff changeset
   115
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
5
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   116
# XXX: Set package name directly to get rid of -Sources?
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   117
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so")
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   118
include(CPack)
e617c9cf6dd3 Updates to build system
Myhailo Danylenko <isbear@ukrpost.net>
parents: 3
diff changeset
   119
34
6bfad7c963f4 Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents: 32
diff changeset
   120
## Set up installer
54
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
   121
install(TARGETS loudmouth DESTINATION lib/lua/${LUA_VERSION})
6bef2082e5f9 v0.9.2 Support for lua 5.2
Myhailo Danylenko <isbear@ukrpost.net>
parents: 48
diff changeset
   122
install(FILES lm.lua DESTINATION share/lua/${LUA_VERSION})
34
6bfad7c963f4 Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents: 32
diff changeset
   123
install(FILES test.lua DESTINATION share/doc/${CPACK_PACKAGE_NAME}/examples)
47
4bf7ef2fea2e Put docgen into a separate package
Myhailo Danylenko <isbear@ukrpost.net>
parents: 44
diff changeset
   124
if(DOCGEN_EXECUTABLE)
34
6bfad7c963f4 Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents: 32
diff changeset
   125
	install(FILES ${lua-lm_BINARY_DIR}/loudmouth.html DESTINATION share/doc/${CPACK_PACKAGE_NAME})
6bfad7c963f4 Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents: 32
diff changeset
   126
endif()
48
ef69edc792be Rearrange docs
Myhailo Danylenko <isbear@ukrpost.net>
parents: 47
diff changeset
   127
install(FILES docs/readme.mdwn docs/todo.mdwn COPYING DESTINATION share/doc/${CPACK_PACKAGE_NAME})
34
6bfad7c963f4 Fix documentation installation path
Myhailo Danylenko <isbear@ukrpost.net>
parents: 32
diff changeset
   128
44
afe0184885a0 Add -g to flags on DEBUG
Myhailo Danylenko <isbear@ukrpost.net>
parents: 40
diff changeset
   129
## The End ## vim: se ts=4 sw=4: ##