CMakeLists.txt
author Myhailo Danylenko <isbear@ukrpost.net>
Thu, 13 Nov 2014 02:32:01 +0200
changeset 35 7ee07b3cc5f9
parent 34 5b818c7467ad
child 37 ed1b8250a170
permissions -rw-r--r--
Use user-configured option names in module description

## Copyright 2009 Myhailo Danylenko
# This file is part of mcabber module writing howto examples.
#
# Examples are free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

cmake_minimum_required(VERSION 2.6) 
project(cmd C) 
set(PROJECT_VERSION "0.0.1")

## User settable options
set(OPT_CMD_HEADER          "cmd_header"          CACHE STRING "Name for mcabber option to enable/disable header with command line")
set(OPT_CMD_HEADER_INLINE   "cmd_header_inline"   CACHE STRING "Name for mcabber option to switch between headline/inline header")
set(OPT_CMD_REDIRECT_STDERR "cmd_redirect_stderr" CACHE STRING "Name for mcabber option to enable stderr capturing")
set(OPT_CMD_SHELL           "cmd_shell"           CACHE STRING "Name for mcabber option to specify shell to be used to execute command")

## Check for build dependencies
find_package(PkgConfig REQUIRED) 
pkg_check_modules(GLIB REQUIRED glib-2.0) 
pkg_check_modules(MCABBER REQUIRED mcabber)
link_directories(${GLIB_LIBRARY_DIRS}
				 ${MCABBER_LIBRARY_DIRS})

## Target definitions
add_library(cmd MODULE cmd.c) 

## Compiler setup
configure_file(config.h.in config.h)
include_directories(SYSTEM ${GLIB_INCLUDE_DIRS} 
                    ${MCABBER_INCLUDE_DIRS})
target_link_libraries(cmd ${GLIB_LIBRARIES} 
					  ${MCABBER_LIBRARIES})
include_directories(${cmd_SOURCE_DIR} 
                    ${cmd_BINARY_DIR})
set_target_properties(cmd PROPERTIES COMPILE_FLAGS "-Wall")

## Packaging information
set(CPACK_PACKAGE_NAME mcabber-mod-cmd)
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_PACKAGE_VENDOR "IsBear")
set(CPACK_PACKAGE_CONTACT "Myhailo Danylenko <isbear@ukrpost.net>")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Mcabber module for sending shell command output to buddies")
set(CPACK_RESOURCE_FILE_LICENSE ${cmd_SOURCE_DIR}/COPYING)
set(CPACK_SOURCE_GENERATOR TBZ2)
set(CPACK_GENERATOR DEB CACHE STRING "Binary package generator, eg DEB, RPM, TGZ, NSIS...")
set(CPACK_DEBIAN_PACKAGE_SECTION libs)
find_program(DPKG_EXECUTABLE dpkg)
if(DPKG_EXECUTABLE)
	execute_process(COMMAND ${DPKG_EXECUTABLE} --print-architecture OUTPUT_VARIABLE CPACK_DEBIAN_PACKAGE_ARCHITECTURE OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
	set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386 CACHE STRING "Architecture of package")
endif()
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
set(CPACK_SOURCE_IGNORE_FILES "/\\\\..*;\\\\.swp;~$;/build/;\\\\.tar\\\\.;\\\\.deb;\\\\.so")
include(CPack)

configure_file(cmd.avv.in cmd.avv)

## Installation
install(TARGETS cmd DESTINATION lib/mcabber) 
install(FILES docs/cmd.rc COPYING docs/readme.mdwn docs/todo.mdwn DESTINATION share/doc/${CPACK_PACKAGE_NAME})
install(DIRECTORY help DESTINATION share/mcabber)
install(FILES ${PROJECT_BINARY_DIR}/cmd.avv DESTINATION share/mcabber/avv/modules RENAME cmd)

## The End ## vim: se ts=4: ##