src/CMakeLists.txt
author Markus Brökers <mbroeker@largo.homelinux.org>
Thu, 26 Aug 2010 18:22:18 +0200
changeset 56 99f85cd9b310
parent 53 ec1eec96e433
child 62 2d6419d6d4ed
permissions -rw-r--r--
fixed an install error in the current build the /etc/rc.d/ folder does no longer exist under ubuntu

PROJECT(mc_bot)

cmake_minimum_required(VERSION 2.4)

# Project Settings
SET(CMAKE_VERBOSE_MAKEFILE Off)
SET(CMAKE_BUILD_TYPE Release)
SET(CMAKE_C_FLAGS_RELEASE "-g -ggdb")

# C-Definitions
ADD_DEFINITIONS(-Wall -O2 -ansi)
ADD_DEFINITIONS(-D_XOPEN_SOURCE=500)
ADD_DEFINITIONS(-DBOT_VERSION=0.99)

# Includes
INCLUDE_DIRECTORIES(../include /usr/local/include)

# Target Definitions
ADD_EXECUTABLE(mcbot compat.c config.c database.c irc.c main.c parse.c)
ADD_EXECUTABLE(dbtool database.c dbtool.c)

# Install Rules
INSTALL(TARGETS mcbot RUNTIME DESTINATION /usr/sbin)
INSTALL(TARGETS dbtool RUNTIME DESTINATION /usr/bin)
INSTALL(DIRECTORY ../locale/ DESTINATION /var/lib/mcbot/data/locale)
INSTALL(PROGRAMS ../scripts/runbot DESTINATION /etc/init.d/ RENAME mcbot)
INSTALL(PROGRAMS ../scripts/mcbot.cgi DESTINATION /usr/lib/cgi-bin/)

# Search required programs
FIND_PROGRAM(MSGFMT_PROG msgfmt)
IF (MSGFMT_PROG)
    EXEC_PROGRAM(${MSGFMT_PROG} ../locale ARGS -o de/LC_MESSAGES/mcbot.mo de/mcbot.po)
ELSE(MSGFMT_PROG)
	MESSAGE(FATAL_ERROR "YOU NEED TO INSTALL gettext")
ENDIF (MSGFMT_PROG)

# Search required libraries
#
# freebsd needs it, debian hates it
#FIND_LIBRARY(GETTEXT_LIB NAMES gettextlib
#	PATHS /usr/lib/ /usr/local/lib)
#IF (GETTEXT_LIB)
#	TARGET_LINK_LIBRARIES(mcbot ${GETTEXT_LIB})
#	TARGET_LINK_LIBRARIES(dbtool ${GETTEXT_LIB})
#ELSE(GETTEXT_LIB)
#	MESSAGE(FATAL_ERROR "YOU NEED TO INSTALL gettext")
#ENDIF (GETTEXT_LIB)

FIND_LIBRARY(GDBM_LIB NAMES gdbm
	PATHS /usr/lib/ /usr/local/lib)
IF (GDBM_LIB)
	TARGET_LINK_LIBRARIES(mcbot ${GDBM_LIB})
	TARGET_LINK_LIBRARIES(dbtool ${GDBM_LIB})
ELSE(GDBM_LIB)
	MESSAGE(FATAL_ERROR "YOU NEED TO INSTALL libgdbm-dev")
ENDIF (GDBM_LIB)