Initial commit
Change-Id: I6a4444e3c193dae437cd7929f4c39aba7b749efa
diff --git a/cmake/Modules/CMakeUserUseBison.cmake b/cmake/Modules/CMakeUserUseBison.cmake
new file mode 100644
index 0000000..9257545
--- /dev/null
+++ b/cmake/Modules/CMakeUserUseBison.cmake
@@ -0,0 +1,72 @@
+# - Look for GNU Bison, the parser generator
+# Based off a news post from Andy Cedilnik at Kitware
+# Defines the following:
+# BISON_EXECUTABLE - path to the bison executable
+# BISON_FILE - parse a file with bison
+# BISON_PREFIX_OUTPUTS - Set to true to make BISON_FILE produce prefixed
+# symbols in the generated output based on filename.
+# So for ${filename}.y, you'll get ${filename}parse(), etc.
+# instead of yyparse().
+# BISON_GENERATE_DEFINES - Set to true to make BISON_FILE output the matching
+# .h file for a .c file. You want this if you're using
+# flex.
+
+IF(NOT DEFINED BISON_PREFIX_OUTPUTS)
+ SET(BISON_PREFIX_OUTPUTS FALSE)
+ENDIF(NOT DEFINED BISON_PREFIX_OUTPUTS)
+
+IF(NOT DEFINED BISON_GENERATE_DEFINES)
+ SET(BISON_GENERATE_DEFINES FALSE)
+ENDIF(NOT DEFINED BISON_GENERATE_DEFINES)
+
+IF(NOT BISON_EXECUTABLE)
+ MESSAGE(STATUS "Looking for bison")
+ FIND_PROGRAM(BISON_EXECUTABLE bison)
+ IF(BISON_EXECUTABLE)
+ MESSAGE(STATUS "Looking for bison -- ${BISON_EXECUTABLE}")
+ ENDIF(BISON_EXECUTABLE)
+ MARK_AS_ADVANCED(BISON_EXECUTABLE)
+ENDIF(NOT BISON_EXECUTABLE)
+
+IF(BISON_EXECUTABLE)
+ MACRO(BISON_FILE FILENAME)
+ GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
+ IF("${PATH}" STREQUAL "")
+ SET(PATH_OPT "")
+ ELSE("${PATH}" STREQUAL "")
+ SET(PATH_OPT "/${PATH}")
+ ENDIF("${PATH}" STREQUAL "")
+ GET_FILENAME_COMPONENT(HEAD "${FILENAME}" NAME_WE)
+ IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ IF(BISON_PREFIX_OUTPUTS)
+ SET(PREFIX "${HEAD}")
+ ELSE(BISON_PREFIX_OUTPUTS)
+ SET(PREFIX "yy")
+ ENDIF(BISON_PREFIX_OUTPUTS)
+ SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab.c")
+ IF(BISON_GENERATE_DEFINES)
+ SET(HEADER "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/${HEAD}.tab.h")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${OUTFILE}" "${HEADER}"
+ COMMAND "${BISON_EXECUTABLE}"
+ ARGS "--name-prefix=${PREFIX}"
+ "--defines"
+ "--output-file=${OUTFILE}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
+ SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" "${HEADER}" PROPERTIES GENERATED TRUE)
+ SET_SOURCE_FILES_PROPERTIES("${HEADER}" PROPERTIES HEADER_FILE_ONLY TRUE)
+ ELSE(BISON_GENERATE_DEFINES)
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${OUTFILE}"
+ COMMAND "${BISON_EXECUTABLE}"
+ ARGS "--name-prefix=${PREFIX}"
+ "--output-file=${OUTFILE}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
+ SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
+ ENDIF(BISON_GENERATE_DEFINES)
+ ENDMACRO(BISON_FILE)
+ENDIF(BISON_EXECUTABLE)
diff --git a/cmake/Modules/CMakeUserUseFlex.cmake b/cmake/Modules/CMakeUserUseFlex.cmake
new file mode 100644
index 0000000..7d0394f
--- /dev/null
+++ b/cmake/Modules/CMakeUserUseFlex.cmake
@@ -0,0 +1,47 @@
+# - Look for GNU flex, the lexer generator.
+# Defines the following:
+# FLEX_EXECUTABLE - path to the flex executable
+# FLEX_FILE - parse a file with flex
+# FLEX_PREFIX_OUTPUTS - Set to true to make FLEX_FILE produce outputs of
+# lex.${filename}.c, not lex.yy.c . Passes -P to flex.
+
+IF(NOT DEFINED FLEX_PREFIX_OUTPUTS)
+ SET(FLEX_PREFIX_OUTPUTS FALSE)
+ENDIF(NOT DEFINED FLEX_PREFIX_OUTPUTS)
+
+IF(NOT FLEX_EXECUTABLE)
+ MESSAGE(STATUS "Looking for flex")
+ FIND_PROGRAM(FLEX_EXECUTABLE flex)
+ IF(FLEX_EXECUTABLE)
+ MESSAGE(STATUS "Looking for flex -- ${FLEX_EXECUTABLE}")
+ ENDIF(FLEX_EXECUTABLE)
+ MARK_AS_ADVANCED(FLEX_EXECUTABLE)
+ENDIF(NOT FLEX_EXECUTABLE)
+
+IF(FLEX_EXECUTABLE)
+ MACRO(FLEX_FILE FILENAME)
+ GET_FILENAME_COMPONENT(PATH "${FILENAME}" PATH)
+ IF("${PATH}" STREQUAL "")
+ SET(PATH_OPT "")
+ ELSE("${PATH}" STREQUAL "")
+ SET(PATH_OPT "/${PATH}")
+ ENDIF("${PATH}" STREQUAL "")
+ IF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ ENDIF(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}")
+ IF(FLEX_PREFIX_OUTPUTS)
+ GET_FILENAME_COMPONENT(PREFIX "${FILENAME}" NAME_WE)
+ ELSE(FLEX_PREFIX_OUTPUTS)
+ SET(PREFIX "yy")
+ ENDIF(FLEX_PREFIX_OUTPUTS)
+ SET(OUTFILE "${CMAKE_CURRENT_BINARY_DIR}${PATH_OPT}/lex.${PREFIX}.c")
+ ADD_CUSTOM_COMMAND(
+ OUTPUT "${OUTFILE}"
+ COMMAND "${FLEX_EXECUTABLE}"
+ ARGS "-P${PREFIX}"
+ "-o${OUTFILE}"
+ "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/${FILENAME}")
+ SET_SOURCE_FILES_PROPERTIES("${OUTFILE}" PROPERTIES GENERATED TRUE)
+ ENDMACRO(FLEX_FILE)
+ENDIF(FLEX_EXECUTABLE)
diff --git a/cmake/Modules/FindGcrypt.cmake b/cmake/Modules/FindGcrypt.cmake
new file mode 100644
index 0000000..fd4517d
--- /dev/null
+++ b/cmake/Modules/FindGcrypt.cmake
@@ -0,0 +1,36 @@
+# - Find gnutls
+# Find the native GCRYPT includes and library
+#
+# GCRYPT_FOUND - True if gnutls found.
+# GCRYPT_INCLUDE_DIR - where to find gnutls.h, etc.
+# GCRYPT_LIBRARIES - List of libraries when using gnutls.
+
+if (GCRYPT_INCLUDE_DIR AND GCRYPT_LIBRARIES)
+ set(GCRYPT_FIND_QUIETLY TRUE)
+endif (GCRYPT_INCLUDE_DIR AND GCRYPT_LIBRARIES)
+
+# Include dir
+find_path(GCRYPT_INCLUDE_DIR
+ NAMES
+ gcrypt.h
+)
+
+# Library
+find_library(GCRYPT_LIBRARY
+ NAMES gcrypt
+)
+
+# handle the QUIETLY and REQUIRED arguments and set GCRYPT_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR)
+
+IF(GCRYPT_FOUND)
+ SET( GCRYPT_LIBRARIES ${GCRYPT_LIBRARY} )
+ELSE(GCRYPT_FOUND)
+ SET( GCRYPT_LIBRARIES )
+ENDIF(GCRYPT_FOUND)
+
+# Lastly make it so that the GCRYPT_LIBRARY and GCRYPT_INCLUDE_DIR variables
+# only show up under the advanced options in the gui cmake applications.
+MARK_AS_ADVANCED( GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR )
diff --git a/cmake/Modules/FindGnuTLS.cmake b/cmake/Modules/FindGnuTLS.cmake
new file mode 100644
index 0000000..19c4fff
--- /dev/null
+++ b/cmake/Modules/FindGnuTLS.cmake
@@ -0,0 +1,64 @@
+# - Find gnutls
+# Find the native GNUTLS includes and library
+#
+# GNUTLS_FOUND - True if gnutls found.
+# GNUTLS_INCLUDE_DIR - where to find gnutls.h, etc.
+# GNUTLS_LIBRARIES - List of libraries when using gnutls.
+# GNUTLS_VERSION_210 - true if GnuTLS version is >= 2.10.0 (does not require additional separate gcrypt initialization)
+# GNUTLS_VERSION_212 - true if GnuTLS version is >= 2.12.0 (supports gnutls_transport_set_vec_push_function)
+# GNUTLS_VERSION_300 - true if GnuTLS version is >= 3.00.0 (x509 verification functions changed)
+# GNUTLS_VERSION_310 - true if GnuTLS version is >= 3.01.0 (stabilization branch with new APIs)
+
+if (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES)
+ set(GNUTLS_FIND_QUIETLY TRUE)
+endif (GNUTLS_INCLUDE_DIR AND GNUTLS_LIBRARIES)
+
+# Include dir
+find_path(GNUTLS_INCLUDE_DIR
+ NAMES
+ gnutls.h
+ gnutls/gnutls.h
+)
+
+# Library
+find_library(GNUTLS_LIBRARY
+ NAMES gnutls
+)
+
+# handle the QUIETLY and REQUIRED arguments and set GNUTLS_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNUTLS DEFAULT_MSG GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR)
+
+IF(GNUTLS_FOUND)
+ SET( GNUTLS_LIBRARIES ${GNUTLS_LIBRARY} )
+ELSE(GNUTLS_FOUND)
+ SET( GNUTLS_LIBRARIES )
+ENDIF(GNUTLS_FOUND)
+
+# Lastly make it so that the GNUTLS_LIBRARY and GNUTLS_INCLUDE_DIR variables
+# only show up under the advanced options in the gui cmake applications.
+MARK_AS_ADVANCED( GNUTLS_LIBRARY GNUTLS_INCLUDE_DIR )
+
+# Now check if the library is recent. gnutls_hash was added in 2.10.0.
+# Also test library is even more recent. gnutls_x509_trust_list_verify_crt was added in 3.00.0.
+IF(GNUTLS_FOUND)
+ IF( NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
+ INCLUDE (CheckLibraryExists)
+ MESSAGE(STATUS "Checking GNUTLS version")
+ UNSET(GNUTLS_VERSION_210)
+ UNSET(GNUTLS_VERSION_210 CACHE)
+ UNSET(GNUTLS_VERSION_212)
+ UNSET(GNUTLS_VERSION_212 CACHE)
+ UNSET(GNUTLS_VERSION_300)
+ UNSET(GNUTLS_VERSION_300 CACHE)
+ UNSET(GNUTLS_VERSION_310)
+ UNSET(GNUTLS_VERSION_310 CACHE)
+ GET_FILENAME_COMPONENT(GNUTLS_PATH ${GNUTLS_LIBRARY} PATH)
+ CHECK_LIBRARY_EXISTS(gnutls gnutls_hash ${GNUTLS_PATH} GNUTLS_VERSION_210)
+ CHECK_LIBRARY_EXISTS(gnutls gnutls_transport_set_vec_push_function ${GNUTLS_PATH} GNUTLS_VERSION_212)
+ CHECK_LIBRARY_EXISTS(gnutls gnutls_x509_trust_list_verify_crt ${GNUTLS_PATH} GNUTLS_VERSION_300)
+ CHECK_LIBRARY_EXISTS(gnutls gnutls_handshake_set_timeout ${GNUTLS_PATH} GNUTLS_VERSION_310)
+ SET( GNUTLS_VERSION_TEST_FOR ${GNUTLS_LIBRARY} CACHE INTERNAL "Version the test was made against" )
+ ENDIF (NOT( "${GNUTLS_VERSION_TEST_FOR}" STREQUAL "${GNUTLS_LIBRARY}" ))
+ENDIF(GNUTLS_FOUND)
diff --git a/cmake/Modules/FindIDNA.cmake b/cmake/Modules/FindIDNA.cmake
new file mode 100644
index 0000000..e5463b4
--- /dev/null
+++ b/cmake/Modules/FindIDNA.cmake
@@ -0,0 +1,40 @@
+# - Try to find GNU IDN library and headers
+# Once done, this will define
+#
+# IDNA_FOUND - system has IDNA
+# IDNA_INCLUDE_DIR - the IDNA include directories (<idna.h>)
+# IDNA_LIBRARIES - link these to use IDNA (idna_to_ascii_8z)
+
+if (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES)
+ set(IDNA_FIND_QUIETLY TRUE)
+endif (IDNA_INCLUDE_DIR AND IDNA_LIBRARIES)
+
+# Include dir
+find_path(IDNA_INCLUDE_DIR
+ NAMES idna.h
+)
+
+# Library
+find_library(IDNA_LIBRARY
+ NAMES idn
+)
+
+
+# handle the QUIETLY and REQUIRED arguments and set IDNA_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(IDNA DEFAULT_MSG IDNA_LIBRARY IDNA_INCLUDE_DIR)
+
+# If we successfully found the idn library then add the library to the
+# IDNA_LIBRARIES cmake variable otherwise set IDNA_LIBRARIES to nothing.
+IF(IDNA_FOUND)
+ SET( IDNA_LIBRARIES ${IDNA_LIBRARY} )
+ELSE(IDNA_FOUND)
+ SET( IDNA_LIBRARIES )
+ENDIF(IDNA_FOUND)
+
+
+# Lastly make it so that the IDNA_LIBRARY and IDNA_INCLUDE_DIR variables
+# only show up under the advanced options in the gui cmake applications.
+MARK_AS_ADVANCED( IDNA_LIBRARY IDNA_INCLUDE_DIR )
+
diff --git a/cmake/Modules/FindLibXml2.cmake b/cmake/Modules/FindLibXml2.cmake
new file mode 100644
index 0000000..e18dc2e
--- /dev/null
+++ b/cmake/Modules/FindLibXml2.cmake
@@ -0,0 +1,53 @@
+# - Try to find the LibXml2 xml processing library
+# Once done this will define
+#
+# LIBXML2_FOUND - System has LibXml2
+# LIBXML2_INCLUDE_DIR - The LibXml2 include directory
+# LIBXML2_LIBRARIES - The libraries needed to use LibXml2
+# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
+# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+# use pkg-config to get the directories and then use these values
+# in the FIND_PATH() and FIND_LIBRARY() calls
+FIND_PACKAGE(PkgConfig)
+PKG_CHECK_MODULES(PC_LIBXML libxml-2.0)
+SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER})
+
+FIND_PATH(LIBXML2_INCLUDE_DIR NAMES libxml/xpath.h
+ HINTS
+ ${PC_LIBXML_INCLUDEDIR}
+ ${PC_LIBXML_INCLUDE_DIRS}
+ PATH_SUFFIXES libxml2
+ )
+
+FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2
+ HINTS
+ ${PC_LIBXML_LIBDIR}
+ ${PC_LIBXML_LIBRARY_DIRS}
+ )
+
+FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint)
+# for backwards compat. with KDE 4.0.x:
+SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}")
+
+# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE)
+
diff --git a/cmake/Modules/FindMySQL.cmake b/cmake/Modules/FindMySQL.cmake
new file mode 100644
index 0000000..c27222b
--- /dev/null
+++ b/cmake/Modules/FindMySQL.cmake
@@ -0,0 +1,56 @@
+# - Find mysqlclient
+#
+# -*- cmake -*-
+#
+# Find the native MySQL includes and library
+#
+# MySQL_INCLUDE_DIR - where to find mysql.h, etc.
+# MySQL_LIBRARIES - List of libraries when using MySQL.
+# MySQL_FOUND - True if MySQL found.
+
+IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
+ # Already in cache, be silent
+ SET(MySQL_FIND_QUIETLY TRUE)
+ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
+
+# Include dir
+FIND_PATH(MySQL_INCLUDE_DIR
+ NAMES mysql.h
+ PATH_SUFFIXES mysql
+)
+
+# Library
+#SET(MySQL_NAMES mysqlclient mysqlclient_r)
+#SET(MySQL_NAMES mysqlclient_r)
+SET(MySQL_NAMES mysqlclient_r mysqlclient)
+FIND_LIBRARY(MySQL_LIBRARY
+ NAMES ${MySQL_NAMES}
+ PATHS /usr/lib /usr/local/lib
+ PATH_SUFFIXES mysql
+)
+
+IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
+ SET(MySQL_FOUND TRUE)
+ SET( MySQL_LIBRARIES ${MySQL_LIBRARY} )
+ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
+ SET(MySQL_FOUND FALSE)
+ SET( MySQL_LIBRARIES )
+ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
+
+
+IF (MySQL_FOUND)
+ IF (NOT MySQL_FIND_QUIETLY)
+ MESSAGE(STATUS "Found MySQL: ${MySQL_LIBRARY}")
+ ENDIF (NOT MySQL_FIND_QUIETLY)
+ELSE (MySQL_FOUND)
+ IF (MySQL_FIND_REQUIRED)
+ MESSAGE(STATUS "Looked for MySQL libraries named ${MySQL_NAMES}.")
+ MESSAGE(FATAL_ERROR "Could NOT find MySQL library")
+ ENDIF (MySQL_FIND_REQUIRED)
+ENDIF (MySQL_FOUND)
+
+MARK_AS_ADVANCED(
+ MySQL_LIBRARY
+ MySQL_INCLUDE_DIR
+ )
+
diff --git a/cmake/Modules/FindPostgreSQL.cmake b/cmake/Modules/FindPostgreSQL.cmake
new file mode 100644
index 0000000..a639a26
--- /dev/null
+++ b/cmake/Modules/FindPostgreSQL.cmake
@@ -0,0 +1,36 @@
+# - Find PostgreSQL library
+#
+# This module defines:
+# POSTGRESQL_FOUND - True if the package is found
+# POSTGRESQL_INCLUDE_DIR - containing libpq-fe.h
+# POSTGRESQL_LIBRARIES - Libraries to link to use PQ functions.
+
+if (POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+ set(POSTGRESQL_FIND_QUIETLY TRUE)
+endif (POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+
+# Include dir
+find_path(POSTGRESQL_INCLUDE_DIR
+ NAMES libpq-fe.h
+ PATH_SUFFIXES pgsql postgresql
+)
+
+# Library
+find_library(POSTGRESQL_LIBRARY
+ NAMES pq
+)
+
+# handle the QUIETLY and REQUIRED arguments and set POSTGRESQL_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(POSTGRESQL DEFAULT_MSG POSTGRESQL_LIBRARY POSTGRESQL_INCLUDE_DIR)
+
+IF(POSTGRESQL_FOUND)
+ SET( POSTGRESQL_LIBRARIES ${POSTGRESQL_LIBRARY} )
+ELSE(POSTGRESQL_FOUND)
+ SET( POSTGRESQL_LIBRARIES )
+ENDIF(POSTGRESQL_FOUND)
+
+# Lastly make it so that the POSTGRESQL_LIBRARY and POSTGRESQL_INCLUDE_DIR variables
+# only show up under the advanced options in the gui cmake applications.
+MARK_AS_ADVANCED( POSTGRESQL_LIBRARY POSTGRESQL_INCLUDE_DIR )
diff --git a/cmake/Modules/FindSCTP.cmake b/cmake/Modules/FindSCTP.cmake
new file mode 100644
index 0000000..de8e878
--- /dev/null
+++ b/cmake/Modules/FindSCTP.cmake
@@ -0,0 +1,46 @@
+# - Try to find SCTP library and headers
+# Once done, this will define
+#
+# SCTP_FOUND - system has SCTP
+# SCTP_INCLUDE_DIR - the SCTP include directories
+# SCTP_LIBRARIES - link these to use SCTP
+
+if (SCTP_INCLUDE_DIR AND SCTP_LIBRARIES)
+ set(SCTP_FIND_QUIETLY TRUE)
+endif (SCTP_INCLUDE_DIR AND SCTP_LIBRARIES)
+
+# Include dir
+find_path(SCTP_INCLUDE_DIR
+ NAMES netinet/sctp.h
+)
+
+# Library
+find_library(SCTP_LIBRARY
+ NAMES sctp
+)
+
+# Set the include dir variables and the libraries and let libfind_process do the rest.
+# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+#set(SCTP_PROCESS_INCLUDES SCTP_INCLUDE_DIR)
+#set(SCTP_PROCESS_LIBS SCTP_LIBRARY)
+#libfind_process(SCTP)
+
+
+# handle the QUIETLY and REQUIRED arguments and set SCTP_FOUND to TRUE if
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(SCTP DEFAULT_MSG SCTP_LIBRARY SCTP_INCLUDE_DIR)
+
+# If we successfully found the sctp library then add the library to the
+# SCTP_LIBRARIES cmake variable otherwise set SCTP_LIBRARIES to nothing.
+IF(SCTP_FOUND)
+ SET( SCTP_LIBRARIES ${SCTP_LIBRARY} )
+ELSE(SCTP_FOUND)
+ SET( SCTP_LIBRARIES )
+ENDIF(SCTP_FOUND)
+
+
+# Lastly make it so that the SCTP_LIBRARY and SCTP_INCLUDE_DIR variables
+# only show up under the advanced options in the gui cmake applications.
+MARK_AS_ADVANCED( SCTP_LIBRARY SCTP_INCLUDE_DIR )
+
diff --git a/cmake/Modules/GetVersionWithHg.cmake b/cmake/Modules/GetVersionWithHg.cmake
new file mode 100644
index 0000000..9fcf392
--- /dev/null
+++ b/cmake/Modules/GetVersionWithHg.cmake
@@ -0,0 +1,23 @@
+# This file is called at build time. It regenerates the version.h file based on the hg version.
+
+EXECUTE_PROCESS(
+ COMMAND ${HGCOMMAND} id -i
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ RESULT_VARIABLE reshash
+ OUTPUT_VARIABLE verhash
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+EXECUTE_PROCESS(
+ COMMAND ${HGCOMMAND} id -n
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ RESULT_VARIABLE resval
+ OUTPUT_VARIABLE verval
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+
+if (reshash EQUAL 0)
+ SET(FD_PROJECT_VERSION_HG "${verval}(${verhash})")
+ message(STATUS "Source version: ${FD_PROJECT_VERSION_HG}")
+endif (reshash EQUAL 0)
+
+CONFIGURE_FILE(${SRC} ${DST})