src/CMakeLists.txt
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sat, 13 Dec 2008 15:42:02 +0100
changeset 24 f68808ae40b9
parent 23 1cd79bb84e9c
child 25 a0fad312ea30
permissions -rw-r--r--
Better checks for msgfmt and libgdbm-dev added * cmake aborts now properly... committer: Markus Bröker <mbroeker@largo.homelinux.org>

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 -pedantic)
ADD_DEFINITIONS(-D_XOPEN_SOURCE=500)
ADD_DEFINITIONS(-DBOT_VERSION=0.96)

# Includes
INCLUDE_DIRECTORIES(../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 sbin)
INSTALL(TARGETS dbtool RUNTIME DESTINATION bin)
INSTALL(DIRECTORY ../locale/ DESTINATION /var/lib/nobody/data/locale)
INSTALL(PROGRAMS ../scripts/runbot DESTINATION /etc/init.d/ 
	RENAME mcbot)

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
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)