diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..b6c826f
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,85 @@
+PROJECT(ngircd)
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+
+SET(NGIRCD_VERSION_MAJOR 0)
+SET(NGIRCD_VERSION_MINOR 12)
+SET(NGIRCD_VERSION_PATCH 0)
+
+SET(CPACK_PACKAGE_VERSION_MAJOR ${NGIRCD_VERSION_MAJOR})
+SET(CPACK_PACKAGE_VERSION_MINOR ${NGIRCD_VERSION_MINOR})
+SET(CPACK_PACKAGE_VERSION_PATCH ${NGIRCD_VERSION_PATCH})
+SET(CPACK_RPM_PACKAGE_LICENSE "GPL")
+SET(CPACK_RPM_PACKAGE_GROUP "Networking/Daemons")
+SET(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/contrib/ngircd.descr)
+
+INCLUDE(CPack)
+
+OPTION(DEBUG "Define if debug-mode should be enabled" OFF)
+OPTION(HAVE_socklen_t "Define if socklen_t exists" ON)
+OPTION(SNIFFER "Define if IRC sniffer should be enabled" OFF)
+OPTION(STRICT_RFC "Define if ngIRCd should behave strict RFC compliant" OFF)
+OPTION(SYSLOG "Define if syslog should be used for logging" ON)
+OPTION(ZLIB "Define if zlib compression should be enabled" ON)
+OPTION(TCPWRAP "Define if TCP wrappers should be used" OFF)
+OPTION(IRCPLUS "Define if IRC+ protocol should be used" ON)
+OPTION(WANT_IPV6 "Define if IPV6 protocol should be enabled" ON)
+OPTION(ZEROCONF "Define if support for Zeroconf should be included" OFF)
+OPTION(IDENTAUTH "Define if the server should do IDENT requests" OFF)
+
+IF (NOT MANDIR)
+	SET(MANDIR man)
+ENDIF (NOT MANDIR)
+
+IF (ZLIB)
+	FIND_PACKAGE(ZLIB REQUIRED)
+	INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
+ENDIF (ZLIB)
+
+INCLUDE(CheckIncludeFile)
+CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H)
+CHECK_INCLUDE_FILE(ctype.h HAVE_CTYPE_H)
+CHECK_INCLUDE_FILE(DNSServiceDiscovery/DNSServiceDiscovery.h HAVE_DNSSERVICEDISCOVERY_DNSSERVICEDISCOVERY_H)
+CHECK_INCLUDE_FILE(ident.h HAVE_IDENT_H)
+CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
+CHECK_INCLUDE_FILE(mach/port.h HAVE_MACH_PORT_H)
+CHECK_INCLUDE_FILE(netinet/ip.h HAVE_NETINET_IP_H)
+CHECK_INCLUDE_FILE(rendezvous/rendezvous.h HAVE_RENDEZVOUS_RENDEZVOUS_H)
+CHECK_INCLUDE_FILE(stdbool.h HAVE_STDBOOL_H)
+CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H)
+CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
+CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
+CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
+CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
+CHECK_INCLUDE_FILE(sys/devpoll.h HAVE_SYS_DEVPOLL_H)
+CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
+
+ADD_DEFINITIONS(-DHAVE_CONFIG_H)
+
+SET(PARAMS 0)
+SET(PROTOTYPES 1)
+SET(HAVE_SNPRINTF 1)
+# SET(HAVE_STRLCAT 1)
+# SET(HAVE_STRLCPY 1)
+SET(HAVE_STRDUP 1)
+SET(HAVE_STRTOK_R 1)
+SET(HAVE_VSNPRINTF 1)
+SET(HAVE_GETNAMEINFO 1)
+SET(HAVE_GETADDRINFO 1)
+SET(HAVE_EPOLL_CREATE 1)
+IF (NOT SYSCONFDIR)
+	SET(SYSCONFDIR "/etc/ngircd")
+ENDIF (NOT SYSCONFDIR)
+SET(PACKAGENAME ${CMAKE_PROJECT_NAME})
+SET(VERSIONNUMBER ${NGIRCD_VERSION_MAJOR}.${NGIRCD_VERSION_MINOR}.${NGIRCD_VERSION_PATCH})
+
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.templ ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
+
+INCLUDE_DIRECTORIES(
+	${CMAKE_CURRENT_BINARY_DIR}
+)
+
+INSTALL(FILES doc/sample-ngircd.conf DESTINATION ${SYSCONFDIR})
+
+ADD_SUBDIRECTORY(man)
+ADD_SUBDIRECTORY(src)
diff --git a/config.h.templ b/config.h.templ
new file mode 100644
index 0000000..14b6383
--- /dev/null
+++ b/config.h.templ
@@ -0,0 +1,99 @@
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+#define SYSCONFDIR "@SYSCONFDIR@"
+#define PACKAGE_NAME "@PACKAGENAME@"
+#define VERSION "@VERSIONNUMBER@"
+
+#cmakedefine HAVE_CTYPE_H 1
+#cmakedefine HAVE_IDENT_H 1
+#cmakedefine HAVE_MACH_PORT_H 1
+#cmakedefine HAVE_NETINET_IP_H 1
+#cmakedefine HAVE_RENDEZVOUS_RENDEZVOUS_H 1
+#cmakedefine HAVE_STDINT_H 1
+#cmakedefine HAVE_STDLIB_H 1
+#cmakedefine HAVE_STRING_H 1
+#cmakedefine HAVE_STRINGS_H 1
+#cmakedefine HAVE_SYS_DEVPOLL_H 1
+
+/* -- Build options -- */
+
+/* Define if debug-mode should be enabled */
+#cmakedefine DEBUG 1
+
+/* Define if the server should do IDENT requests */
+#cmakedefine IDENTAUTH 1
+
+/* Define if IRC+ protocol should be used */
+#cmakedefine IRCPLUS 1
+
+/* Define if IRC sniffer should be enabled */
+#cmakedefine SNIFFER 1
+
+/* Define if syslog should be used for logging */
+#cmakedefine SYSLOG 1
+
+/* Define if TCP wrappers should be used */
+#cmakedefine TCPWRAP 1
+
+/* Define if support for Zeroconf should be included */
+#cmakedefine ZEROCONF 1
+
+/* Define if zlib compression should be enabled */
+#cmakedefine ZLIB 1
+
+/* -- Supported features -- */
+
+/* Define if SSP C support is enabled. */
+#cmakedefine ENABLE_SSP_CC 1
+
+/* Define to 1 if the C compiler supports function prototypes. */
+#cmakedefine PROTOTYPES 1
+/* Define like PROTOTYPES; this can be used by system headers. */
+#cmakedefine __PROTOTYPES 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#cmakedefine HAVE_SYS_TYPES_H 1
+/* Define to 1 if you have the <inttypes.h> header file. */
+#cmakedefine HAVE_INTTYPES_H 1
+/* Define to 1 if you have the <stddef.h> header file. */
+#cmakedefine HAVE_STDDEF_H 1
+/* Define to 1 if you have the <stdbool.h> header file. */
+#cmakedefine HAVE_STDBOOL_H 1
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#cmakedefine HAVE_ARPA_INET_H 1
+
+/* Define to 1 if you have the `kqueue' function. */
+#cmakedefine HAVE_KQUEUE 1
+/* Define to 1 if you have the `inet_ntoa' function. */
+#cmakedefine HAVE_INET_NTOA 1
+/* Define to 1 if you have the `snprintf' function. */
+#cmakedefine HAVE_SNPRINTF 1
+/* Define to 1 if you have the `strlcat' function. */
+#cmakedefine HAVE_STRLCAT 1
+/* Define to 1 if you have the `strlcpy' function. */
+#cmakedefine HAVE_STRLCPY 1
+/* Define to 1 if you have the `strdup' function. */
+#cmakedefine HAVE_STRDUP 1
+/* Define to 1 if you have the `vsnprintf' function. */
+#cmakedefine HAVE_VSNPRINTF 1
+
+/* Define if socklen_t exists */
+#cmakedefine HAVE_socklen_t 1
+
+#ifdef ZEROCONF
+/* Define to 1 if you have the <DNSServiceDiscovery/DNSServiceDiscovery.h> header file. */
+#define HAVE_DNSSERVICEDISCOVERY_DNSSERVICEDISCOVERY_H 1
+/* Define to 1 if you have the `DNSServiceRegistrationCreate' function. */
+#cmakedefine HAVE_DNSSERVICEREGISTRATIONCREATE 1
+#endif
+
+#cmakedefine IDENTAUTH 1
+#cmakedefine WANT_IPV6 1
+
+#cmakedefine HAVE_STRTOK_R 1
+#cmakedefine HAVE_GETNAMEINFO 1
+#cmakedefine HAVE_GETADDRINFO 1
+#cmakedefine HAVE_EPOLL_CREATE 1
+
+#endif /* __CONFIG_H */
diff --git a/contrib/ngircd.descr b/contrib/ngircd.descr
new file mode 100644
index 0000000..790acb5
--- /dev/null
+++ b/contrib/ngircd.descr
@@ -0,0 +1,12 @@
+ngIRCd is a free open source daemon for the Internet Relay Chat (IRC),
+developed under the GNU General Public License (GPL). It's written from
+scratch and is not based upon the original IRCd like many others.
+
+Advantages:
+ - no problems with servers using changing/non-static IP addresses.
+ - small and lean configuration file.
+ - free, modern and open source C code.
+ - still under active development.
+
+ngIRCd is compatible to the "original" ircd 2.10.3p3, so you can run
+mixed networks.
diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt
new file mode 100644
index 0000000..5d18a11
--- /dev/null
+++ b/man/CMakeLists.txt
@@ -0,0 +1,5 @@
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ngircd.8.tmpl ${CMAKE_CURRENT_BINARY_DIR}/ngircd.8 @ONLY)
+CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/ngircd.conf.5.tmpl ${CMAKE_CURRENT_BINARY_DIR}/ngircd.conf.5 @ONLY)
+
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngircd.8 DESTINATION ${MANDIR}/man8)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/ngircd.conf.5 DESTINATION ${MANDIR}/man5)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 0000000..70fc20e
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,5 @@
+ADD_SUBDIRECTORY(ipaddr)
+ADD_SUBDIRECTORY(ngircd)
+ADD_SUBDIRECTORY(portab)
+ADD_SUBDIRECTORY(testsuite)
+ADD_SUBDIRECTORY(tool)
diff --git a/src/ipaddr/CMakeLists.txt b/src/ipaddr/CMakeLists.txt
new file mode 100644
index 0000000..b93bd58
--- /dev/null
+++ b/src/ipaddr/CMakeLists.txt
@@ -0,0 +1,13 @@
+INCLUDE_DIRECTORIES(
+	../portab
+)
+
+SET(NGIPADDR_SRCS
+	ng_ipaddr.c
+)
+
+SET(NGIPADDR_HDRS
+	ng_ipaddr.h
+)
+
+ADD_LIBRARY(ngipaddr ${NGIPADDR_SRCS} ${NGIPADDR_HDRS})
diff --git a/src/ngircd/CMakeLists.txt b/src/ngircd/CMakeLists.txt
new file mode 100644
index 0000000..5627cd3
--- /dev/null
+++ b/src/ngircd/CMakeLists.txt
@@ -0,0 +1,121 @@
+INCLUDE_DIRECTORIES(
+	../portab
+	../tool
+	../ipaddr
+)
+
+SET(NGIRCD_SRCS
+	ngircd.c
+	array.c
+	channel.c
+	client.c
+	conf.c
+	conn.c
+	conn-func.c
+	conn-zip.c
+	hash.c
+	io.c
+	irc.c
+	irc-channel.c
+	irc-info.c
+	irc-login.c
+	irc-mode.c
+	irc-op.c
+	irc-oper.c
+	irc-server.c
+	irc-write.c
+	lists.c
+	log.c
+	match.c
+	numeric.c
+	parse.c
+	rendezvous.c
+	resolve.c
+)
+
+SET(NGIRCD_HDRS
+	ngircd.h
+	array.h
+	channel.h
+	client.h
+	conf.h
+	conn.h
+	conn-func.h
+	conn-zip.h
+	hash.h
+	io.h
+	irc.h
+	irc-channel.h
+	irc-info.h
+	irc-login.h
+	irc-mode.h
+	irc-op.h
+	irc-oper.h
+	irc-server.h
+	irc-write.h
+	lists.h
+	log.h
+	match.h
+	numeric.h
+	parse.h
+	rendezvous.h
+	resolve.h
+	defines.h
+	messages.h
+)
+
+ADD_EXECUTABLE(ngircd ${NGIRCD_SRCS} ${NGIRCD_HDRS})
+
+INSTALL(TARGETS ngircd DESTINATION sbin)
+
+TARGET_LINK_LIBRARIES(ngircd ngportab ngtool ngipaddr)
+IF (ZLIB)
+	TARGET_LINK_LIBRARIES(ngircd ${ZLIB_LIBRARIES})
+ENDIF (ZLIB)
+
+#LINTARGS = -weak -warnunixlib +unixlib -booltype BOOLEAN \
+# -varuse -retvalother -emptyret -unrecog
+
+#clean-local:
+#	rm -f check-version check-help lint.out
+
+#maintainer-clean-local:
+#	rm -f Makefile Makefile.in
+
+#check-version: Makefile
+#	echo "#!/bin/sh" > check-version
+#	echo "./ngircd --version | grep ngircd >/dev/null 2>&1" >>check-version
+#	chmod 755 check-version
+
+#check-help: Makefile
+#	echo "#!/bin/sh" > check-help
+#	echo "./ngircd --help | grep help >/dev/null 2>&1" >>check-help
+#	chmod 755 check-help
+
+#lint:
+#	@splint --version >/dev/null 2>&1 \
+#	 || ( echo; echo "Error: \"splint\" not found!"; echo; exit 1 )
+#	@echo; warnings=0; files=0; \
+#	for f in *.c; do \
+#	 echo "checking $$f ..."; \
+#	 splint $$f $(LINTARGS) -I$(srcdir) -I$(srcdir)/.. \
+#	  $(INCLUDES) $(AM_CFLAGS) >lint.out 2>&1; \
+#	 grep "no warnings" lint.out > /dev/null 2>&1; \
+#	 if [ $$? -ne 0 ]; then \
+#	  waswarning=1; \
+#	  echo; grep -v "^Command Line: " lint.out; echo; \
+#	  w=$$( grep "code warning" lint.out | $(AWK) "{ print \$$4 }" ); \
+#	  [ "$$w" -gt 0 ] && warnings=`expr $$warnings + $$w`; \
+#	  files=`expr $$files + 1`; \
+#	 else \
+#	  waswarning=0; \
+#	 fi; \
+#	 rm -f lint.out; \
+#	done; \
+#	[ $$waswarning -eq 0 ] && echo; \
+#	[ $$warnings -gt 0 ] \
+#	 && echo "Result: $$warnings warning(s) in $$files file(s)!" \
+#	 || echo "Result: no warnings found."; \
+#	echo; [ $$warnings -gt 0 ] && exit 1
+
+#TESTS = check-version check-help
diff --git a/src/portab/CMakeLists.txt b/src/portab/CMakeLists.txt
new file mode 100644
index 0000000..aa9e2c8
--- /dev/null
+++ b/src/portab/CMakeLists.txt
@@ -0,0 +1,22 @@
+SET(NGPORTAB_SRCS
+	strdup.c
+	strlcpy.c
+	strtok_r.c
+	vsnprintf.c
+	waitpid.c
+)
+
+SET(NGPORTAB_HDRS
+	imp.h
+	exp.h
+	portab.h
+)
+
+ADD_LIBRARY(ngportab ${NGPORTAB_SRCS})
+
+SET(PORTABTEST_SRCS
+	portabtest.c
+)
+
+ADD_EXECUTABLE(portabtest ${PORTABTEST_SRCS})
+TARGET_LINK_LIBRARIES(portabtest ngportab)
diff --git a/src/tool/CMakeLists.txt b/src/tool/CMakeLists.txt
new file mode 100644
index 0000000..1389799
--- /dev/null
+++ b/src/tool/CMakeLists.txt
@@ -0,0 +1,13 @@
+INCLUDE_DIRECTORIES(
+	../portab
+)
+
+SET(NGTOOL_SRCS
+	tool.c
+)
+
+SET(NGTOOL_HDRS
+	tool.h
+)
+
+ADD_LIBRARY(ngtool ${NGTOOL_SRCS} ${NGTOOL_HDRS})
