File CMakeLists.txt of Package netcat-openbsd

#
# Cmake Build script for netcat-openbsd 
# Author : Cristian Rodríguez <crrodriguez@suse.de>
#
# Copyright (c) 2008 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/

PROJECT(netcat-openbsd C)
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -g -W -Wall")

#please fix cmake to avoid this %$#$#$ , there is no findGlib2.cmake built-in !
FIND_PATH(GLIB2_INCLUDE_DIR NAMES glib.h glibconfig.h PATHS /usr/include/glib-2.0)
FIND_PATH(GLIB2_WEIRD_INCLUDE_DIR NAMES glibconfig.h PATHS /usr/lib/glib-2.0/include /usr/lib64/glib-2.0/include)
FIND_LIBRARY(GLIB2_LIBRARY NAMES glib-2.0)

INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/openbsd-compat)
INCLUDE_DIRECTORIES(${GLIB2_INCLUDE_DIR})
INCLUDE_DIRECTORIES(${GLIB2_WEIRD_INCLUDE_DIR})

SET(NETCAT_SRCS netcat.c atomicio.c socks.c openbsd-compat/base64.c openbsd-compat/readpassphrase.c)
ADD_EXECUTABLE(nc ${NETCAT_SRCS})
TARGET_LINK_LIBRARIES(nc ${GLIB2_LIBRARY})
INSTALL(PROGRAMS nc DESTINATION bin)
INSTALL(FILES nc.1 DESTINATION share/man/man1)