aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2009-02-02 14:44:46 +0000
committerAndreas Schneider <mail@cynapses.org>2009-02-02 14:44:46 +0000
commit460d0b402bac86221fd94f086ef88f94f584df1f (patch)
tree5f04167dabc7bff9273a4dffafcba7b9d7f0a578 /cmake/Modules
parent234706548121cb9acf609b6cce71d53144143968 (diff)
downloadlibssh-460d0b402bac86221fd94f086ef88f94f584df1f.tar.gz
libssh-460d0b402bac86221fd94f086ef88f94f584df1f.tar.xz
libssh-460d0b402bac86221fd94f086ef88f94f584df1f.zip
Add Makefiles for the CMake build system.
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@203 7dcaeef0-15fb-0310-b436-a5af3365683c
Diffstat (limited to 'cmake/Modules')
-rw-r--r--cmake/Modules/COPYING-CMAKE-SCRIPTS22
-rw-r--r--cmake/Modules/DefineCMakeDefaults.cmake28
-rw-r--r--cmake/Modules/DefineCompilerFlags.cmake49
-rw-r--r--cmake/Modules/DefineInstallationPaths.cmake124
-rw-r--r--cmake/Modules/FindGCrypt.cmake77
-rw-r--r--cmake/Modules/FindOpenSSL.cmake153
-rw-r--r--cmake/Modules/FindZLIB.cmake77
-rw-r--r--cmake/Modules/MacroAddCompileFlags.cmake21
-rw-r--r--cmake/Modules/MacroAddLinkFlags.cmake20
-rw-r--r--cmake/Modules/MacroAddPlugin.cmake30
-rw-r--r--cmake/Modules/MacroCopyFile.cmake33
-rw-r--r--cmake/Modules/MacroEnsureOutOfSourceBuild.cmake17
-rw-r--r--cmake/Modules/UseDoxygen.cmake127
13 files changed, 778 insertions, 0 deletions
diff --git a/cmake/Modules/COPYING-CMAKE-SCRIPTS b/cmake/Modules/COPYING-CMAKE-SCRIPTS
new file mode 100644
index 0000000..4b41776
--- /dev/null
+++ b/cmake/Modules/COPYING-CMAKE-SCRIPTS
@@ -0,0 +1,22 @@
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/cmake/Modules/DefineCMakeDefaults.cmake b/cmake/Modules/DefineCMakeDefaults.cmake
new file mode 100644
index 0000000..79df274
--- /dev/null
+++ b/cmake/Modules/DefineCMakeDefaults.cmake
@@ -0,0 +1,28 @@
+# Always include srcdir and builddir in include path
+# This saves typing ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY} in
+# about every subdir
+# since cmake 2.4.0
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+# Put the include dirs which are in the source or build tree
+# before all other include dirs, so the headers in the sources
+# are prefered over the already installed ones
+# since cmake 2.4.1
+set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
+
+# Use colored output
+# since cmake 2.4.0
+set(CMAKE_COLOR_MAKEFILE ON)
+
+# Define the generic version of the libraries here
+set(GENERIC_LIB_VERSION "0.1.0")
+set(GENERIC_LIB_SOVERSION "0")
+
+# Set the default build type to release with debug info
+if (NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE RelWithDebInfo
+ CACHE STRING
+ "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
+ FORCE
+ )
+endif (NOT CMAKE_BUILD_TYPE)
diff --git a/cmake/Modules/DefineCompilerFlags.cmake b/cmake/Modules/DefineCompilerFlags.cmake
new file mode 100644
index 0000000..84b771f
--- /dev/null
+++ b/cmake/Modules/DefineCompilerFlags.cmake
@@ -0,0 +1,49 @@
+# define system dependent compiler flags
+
+include(CheckCCompilerFlag)
+
+if (UNIX AND NOT WIN32)
+ # with -fPIC
+ check_c_compiler_flag("-fPIC" WITH_FPIC)
+ if (WITH_FPIC)
+ add_definitions(-fPIC)
+ endif (WITH_FPIC)
+
+ if (CMAKE_SIZEOF_VOID_P MATCHES "8")
+ # with large file support
+ execute_process(
+ COMMAND
+ getconf LFS64_CFLAGS
+ OUTPUT_VARIABLE
+ _lfs_CFLAGS
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ else (CMAKE_SIZEOF_VOID_P MATCHES "8")
+ # with large file support
+ execute_process(
+ COMMAND
+ getconf LFS_CFLAGS
+ OUTPUT_VARIABLE
+ _lfs_CFLAGS
+ ERROR_QUIET
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ endif (CMAKE_SIZEOF_VOID_P MATCHES "8")
+
+ string(REGEX REPLACE "[\r\n]" " " ${_lfs_CFLAGS} "${${_lfs_CFLAGS}}")
+
+ add_definitions(${_lfs_CFLAGS})
+ add_definitions(-Wall -Wextra -Wmissing-prototypes -Wdeclaration-after-statement -Wunused)
+
+ check_c_compiler_flag("-fstack-protector" WITH_STACK_PROTECTOR)
+ if (WITH_STACK_PROTECTOR)
+ add_definitions(-fstack-protector)
+ endif (WITH_STACK_PROTECTOR)
+
+ check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
+ if (WITH_FORTIFY_SOURCE)
+ add_definitions(-D_FORTIFY_SOURCE=2)
+ endif (WITH_FORTIFY_SOURCE)
+
+endif (UNIX AND NOT WIN32)
diff --git a/cmake/Modules/DefineInstallationPaths.cmake b/cmake/Modules/DefineInstallationPaths.cmake
new file mode 100644
index 0000000..5c4caf7
--- /dev/null
+++ b/cmake/Modules/DefineInstallationPaths.cmake
@@ -0,0 +1,124 @@
+if (UNIX)
+ IF (NOT APPLICATION_NAME)
+ MESSAGE(STATUS "${PROJECT_NAME} is used as APPLICATION_NAME")
+ SET(APPLICATION_NAME ${PROJECT_NAME})
+ ENDIF (NOT APPLICATION_NAME)
+
+ # Suffix for Linux
+ SET(LIB_SUFFIX
+ CACHE STRING "Define suffix of directory name (32/64)"
+ )
+
+ SET(EXEC_INSTALL_PREFIX
+ "${CMAKE_INSTALL_PREFIX}"
+ CACHE PATH "Base directory for executables and libraries"
+ FORCE
+ )
+ SET(SHARE_INSTALL_PREFIX
+ "${CMAKE_INSTALL_PREFIX}/share"
+ CACHE PATH "Base directory for files which go to share/"
+ FORCE
+ )
+ SET(DATA_INSTALL_PREFIX
+ "${SHARE_INSTALL_PREFIX}/${APPLICATION_NAME}"
+ CACHE PATH "The parent directory where applications can install their data" FORCE)
+
+ # The following are directories where stuff will be installed to
+ SET(BIN_INSTALL_DIR
+ "${EXEC_INSTALL_PREFIX}/bin"
+ CACHE PATH "The ${APPLICATION_NAME} binary install dir (default prefix/bin)"
+ FORCE
+ )
+ SET(SBIN_INSTALL_DIR
+ "${EXEC_INSTALL_PREFIX}/sbin"
+ CACHE PATH "The ${APPLICATION_NAME} sbin install dir (default prefix/sbin)"
+ FORCE
+ )
+ SET(LIB_INSTALL_DIR
+ "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"
+ CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/lib)"
+ FORCE
+ )
+ SET(LIBEXEC_INSTALL_DIR
+ "${EXEC_INSTALL_PREFIX}/libexec"
+ CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is prefix/libexec)"
+ FORCE
+ )
+ SET(PLUGIN_INSTALL_DIR
+ "${LIB_INSTALL_DIR}/${APPLICATION_NAME}"
+ CACHE PATH "The subdirectory relative to the install prefix where plugins will be installed (default is prefix/lib/${APPLICATION_NAME})"
+ FORCE
+ )
+ SET(INCLUDE_INSTALL_DIR
+ "${CMAKE_INSTALL_PREFIX}/include"
+ CACHE PATH "The subdirectory to the header prefix (default prefix/include)"
+ FORCE
+ )
+
+ SET(DATA_INSTALL_DIR
+ "${DATA_INSTALL_PREFIX}"
+ CACHE PATH "The parent directory where applications can install their data (default prefix/share/${APPLICATION_NAME})"
+ FORCE
+ )
+ SET(HTML_INSTALL_DIR
+ "${DATA_INSTALL_PREFIX}/doc/HTML"
+ CACHE PATH "The HTML install dir for documentation (default data/doc/html)"
+ FORCE
+ )
+ SET(ICON_INSTALL_DIR
+ "${DATA_INSTALL_PREFIX}/icons"
+ CACHE PATH "The icon install dir (default data/icons/)"
+ FORCE
+ )
+ SET(SOUND_INSTALL_DIR
+ "${DATA_INSTALL_PREFIX}/sounds"
+ CACHE PATH "The install dir for sound files (default data/sounds)"
+ FORCE
+ )
+
+ SET(LOCALE_INSTALL_DIR
+ "${SHARE_INSTALL_PREFIX}/locale"
+ CACHE PATH "The install dir for translations (default prefix/share/locale)"
+ FORCE
+ )
+
+ SET(XDG_APPS_DIR
+ "${SHARE_INSTALL_PREFIX}/applications/"
+ CACHE PATH "The XDG apps dir"
+ FORCE
+ )
+ SET(XDG_DIRECTORY_DIR
+ "${SHARE_INSTALL_PREFIX}/desktop-directories"
+ CACHE PATH "The XDG directory"
+ FORCE
+ )
+
+ SET(SYSCONF_INSTALL_DIR
+ "${EXEC_INSTALL_PREFIX}/etc"
+ CACHE PATH "The ${APPLICATION_NAME} sysconfig install dir (default prefix/etc)"
+ FORCE
+ )
+ SET(MAN_INSTALL_DIR
+ "${SHARE_INSTALL_PREFIX}/man"
+ CACHE PATH "The ${APPLICATION_NAME} man install dir (default prefix/man)"
+ FORCE
+ )
+ SET(INFO_INSTALL_DIR
+ "${SHARE_INSTALL_PREFIX}/info"
+ CACHE PATH "The ${APPLICATION_NAME} info install dir (default prefix/info)"
+ FORCE
+ )
+endif (UNIX)
+
+if (WIN32)
+ # Same same
+ SET(BIN_INSTALL_DIR .)
+ SET(SBIN_INSTALL_DIR .)
+ SET(LIB_INSTALL_DIR .)
+ SET(PLUGIN_INSTALL_DIR plugins)
+ SET(HTML_INSTALL_DIR doc/HTML)
+ SET(ICON_INSTALL_DIR .)
+ SET(SOUND_INSTALL_DIR .)
+ SET(LOCALE_INSTALL_DIR lang)
+endif (WIN32)
+
diff --git a/cmake/Modules/FindGCrypt.cmake b/cmake/Modules/FindGCrypt.cmake
new file mode 100644
index 0000000..3c3761c
--- /dev/null
+++ b/cmake/Modules/FindGCrypt.cmake
@@ -0,0 +1,77 @@
+# - Try to find GCrypt
+# Once done this will define
+#
+# GCRYPT_FOUND - system has GCrypt
+# GCRYPT_INCLUDE_DIRS - the GCrypt include directory
+# GCRYPT_LIBRARIES - Link these to use GCrypt
+# GCRYPT_DEFINITIONS - Compiler switches required for using GCrypt
+#
+# Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+ # in cache already
+ set(GCRYPT_FOUND TRUE)
+else (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+
+ find_path(GCRYPT_INCLUDE_DIR
+ NAMES
+ gcrypt.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+ mark_as_advanced(GCRYPT_INCLUDE_DIR)
+
+ find_library(GCRYPT_LIBRARY
+ NAMES
+ gcrypt
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(GCRYPT_LIBRARY)
+
+ if (GCRYPT_LIBRARY)
+ set(GCRYPT_FOUND TRUE)
+ endif (GCRYPT_LIBRARY)
+
+ set(GCRYPT_INCLUDE_DIRS
+ ${GCRYPT_INCLUDE_DIR}
+ )
+
+ if (GCRYPT_FOUND)
+ set(GCRYPT_LIBRARIES
+ ${GCRYPT_LIBRARIES}
+ ${GCRYPT_LIBRARY}
+ )
+ endif (GCRYPT_FOUND)
+
+ if (GCRYPT_INCLUDE_DIRS AND GCRYPT_LIBRARIES)
+ set(GCRYPT_FOUND TRUE)
+ endif (GCRYPT_INCLUDE_DIRS AND GCRYPT_LIBRARIES)
+
+ if (GCRYPT_FOUND)
+ if (NOT GCrypt_FIND_QUIETLY)
+ message(STATUS "Found GCrypt: ${GCRYPT_LIBRARIES}")
+ endif (NOT GCrypt_FIND_QUIETLY)
+ else (GCRYPT_FOUND)
+ if (GCrypt_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find GCrypt")
+ endif (GCrypt_FIND_REQUIRED)
+ endif (GCRYPT_FOUND)
+
+ # show the GCRYPT_INCLUDE_DIRS and GCRYPT_LIBRARIES variables only in the advanced view
+ mark_as_advanced(GCRYPT_INCLUDE_DIRS GCRYPT_LIBRARIES)
+
+endif (GCRYPT_LIBRARIES AND GCRYPT_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/FindOpenSSL.cmake b/cmake/Modules/FindOpenSSL.cmake
new file mode 100644
index 0000000..85c7473
--- /dev/null
+++ b/cmake/Modules/FindOpenSSL.cmake
@@ -0,0 +1,153 @@
+# - Try to find OpenSSL
+# Once done this will define
+#
+# OPENSSL_FOUND - system has OpenSSL
+# OPENSSL_INCLUDE_DIRS - the OpenSSL include directory
+# OPENSSL_LIBRARIES - Link these to use OpenSSL
+# OPENSSL_DEFINITIONS - Compiler switches required for using OpenSSL
+#
+# Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
+ # in cache already
+ set(OPENSSL_FOUND TRUE)
+else (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
+ # use pkg-config to get the directories and then use these values
+ # in the FIND_PATH() and FIND_LIBRARY() calls
+ if (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ include(UsePkgConfig)
+ pkgconfig(openssl _OPENSSL_INCLUDEDIR _OPENSSL_LIBDIR _OPENSSL_LDFLAGS _OPENSSL_CFLAGS)
+ else (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+ find_package(PkgConfig)
+ if (PKG_CONFIG_FOUND)
+ pkg_check_modules(_OPENSSL openssl)
+ endif (PKG_CONFIG_FOUND)
+ endif (${CMAKE_MAJOR_VERSION} EQUAL 2 AND ${CMAKE_MINOR_VERSION} EQUAL 4)
+
+ find_path(OPENSSL_INCLUDE_DIR
+ NAMES
+ openssl/ssl.h
+ PATHS
+ ${_OPENSSL_INCLUDEDIR}
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+ mark_as_advanced(OPENSSL_INCLUDE_DIR)
+
+ find_library(SSL_LIBRARY
+ NAMES
+ ssl
+ PATHS
+ ${_OPENSSL_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(SSL_LIBRARY)
+
+ find_library(SSLEAY32_LIBRARY
+ NAMES
+ ssleay32
+ PATHS
+ ${_OPENSSL_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(SSLEAY32_LIBRARY)
+
+ find_library(SSLEAY32MD_LIBRARY
+ NAMES
+ ssleay32MD
+ PATHS
+ ${_OPENSSL_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(SSLEAY32MD_LIBRARY)
+
+ find_library(CRYPTO_LIBRARY
+ NAMES
+ crypto
+ PATHS
+ ${_OPENSSL_LIBDIR}
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(CRYPTO_LIBRARY)
+
+ if (SSL_LIBRARY)
+ set(SSL_FOUND TRUE)
+ endif (SSL_LIBRARY)
+ if (SSLEAY32_LIBRARY)
+ set(SSLEAY32_FOUND TRUE)
+ endif (SSLEAY32_LIBRARY)
+ if (SSLEAY32MD_LIBRARY)
+ set(SSLEAY32MD_FOUND TRUE)
+ endif (SSLEAY32MD_LIBRARY)
+ if (CRYPTO_LIBRARY)
+ set(CRYPTO_FOUND TRUE)
+ endif (CRYPTO_LIBRARY)
+
+ set(OPENSSL_INCLUDE_DIRS
+ ${OPENSSL_INCLUDE_DIR}
+ )
+
+ if (SSL_FOUND)
+ set(OPENSSL_LIBRARIES
+ ${OPENSSL_LIBRARIES}
+ ${SSL_LIBRARY}
+ )
+ endif (SSL_FOUND)
+ if (SSLEAY32_FOUND)
+ set(OPENSSL_LIBRARIES
+ ${OPENSSL_LIBRARIES}
+ ${SSLEAY32_LIBRARY}
+ )
+ endif (SSLEAY32_FOUND)
+ if (SSLEAY32MD_FOUND)
+ set(OPENSSL_LIBRARIES
+ ${OPENSSL_LIBRARIES}
+ ${SSLEAY32MD_LIBRARY}
+ )
+ endif (SSLEAY32MD_FOUND)
+ if (CRYPTO_FOUND)
+ set(OPENSSL_LIBRARIES
+ ${OPENSSL_LIBRARIES}
+ ${CRYPTO_LIBRARY}
+ )
+ endif (CRYPTO_FOUND)
+
+ if (OPENSSL_INCLUDE_DIRS AND OPENSSL_LIBRARIES)
+ set(OPENSSL_FOUND TRUE)
+ endif (OPENSSL_INCLUDE_DIRS AND OPENSSL_LIBRARIES)
+
+ if (OPENSSL_FOUND)
+ if (NOT OpenSSL_FIND_QUIETLY)
+ message(STATUS "Found OpenSSL: ${OPENSSL_LIBRARIES}")
+ endif (NOT OpenSSL_FIND_QUIETLY)
+ else (OPENSSL_FOUND)
+ if (OpenSSL_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find OpenSSL")
+ endif (OpenSSL_FIND_REQUIRED)
+ endif (OPENSSL_FOUND)
+
+ # show the OPENSSL_INCLUDE_DIRS and OPENSSL_LIBRARIES variables only in the advanced view
+ mark_as_advanced(OPENSSL_INCLUDE_DIRS OPENSSL_LIBRARIES)
+
+endif (OPENSSL_LIBRARIES AND OPENSSL_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/FindZLIB.cmake b/cmake/Modules/FindZLIB.cmake
new file mode 100644
index 0000000..264cf1b
--- /dev/null
+++ b/cmake/Modules/FindZLIB.cmake
@@ -0,0 +1,77 @@
+# - Try to find ZLIB
+# Once done this will define
+#
+# ZLIB_FOUND - system has ZLIB
+# ZLIB_INCLUDE_DIRS - the ZLIB include directory
+# ZLIB_LIBRARIES - Link these to use ZLIB
+# ZLIB_DEFINITIONS - Compiler switches required for using ZLIB
+#
+# Copyright (c) 2009 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the New
+# BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+#
+
+
+if (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
+ # in cache already
+ set(ZLIB_FOUND TRUE)
+else (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
+
+ find_path(ZLIB_INCLUDE_DIR
+ NAMES
+ zlib.h
+ PATHS
+ /usr/include
+ /usr/local/include
+ /opt/local/include
+ /sw/include
+ )
+ mark_as_advanced(ZLIB_INCLUDE_DIR)
+
+ find_library(Z_LIBRARY
+ NAMES
+ z
+ PATHS
+ /usr/lib
+ /usr/local/lib
+ /opt/local/lib
+ /sw/lib
+ )
+ mark_as_advanced(Z_LIBRARY)
+
+ if (Z_LIBRARY)
+ set(Z_FOUND TRUE)
+ endif (Z_LIBRARY)
+
+ set(ZLIB_INCLUDE_DIRS
+ ${ZLIB_INCLUDE_DIR}
+ )
+
+ if (Z_FOUND)
+ set(ZLIB_LIBRARIES
+ ${ZLIB_LIBRARIES}
+ ${Z_LIBRARY}
+ )
+ endif (Z_FOUND)
+
+ if (ZLIB_INCLUDE_DIRS AND ZLIB_LIBRARIES)
+ set(ZLIB_FOUND TRUE)
+ endif (ZLIB_INCLUDE_DIRS AND ZLIB_LIBRARIES)
+
+ if (ZLIB_FOUND)
+ if (NOT ZLIB_FIND_QUIETLY)
+ message(STATUS "Found ZLIB: ${ZLIB_LIBRARIES}")
+ endif (NOT ZLIB_FIND_QUIETLY)
+ else (ZLIB_FOUND)
+ if (ZLIB_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find ZLIB")
+ endif (ZLIB_FIND_REQUIRED)
+ endif (ZLIB_FOUND)
+
+ # show the ZLIB_INCLUDE_DIRS and ZLIB_LIBRARIES variables only in the advanced view
+ mark_as_advanced(ZLIB_INCLUDE_DIRS ZLIB_LIBRARIES)
+
+endif (ZLIB_LIBRARIES AND ZLIB_INCLUDE_DIRS)
+
diff --git a/cmake/Modules/MacroAddCompileFlags.cmake b/cmake/Modules/MacroAddCompileFlags.cmake
new file mode 100644
index 0000000..a866689
--- /dev/null
+++ b/cmake/Modules/MacroAddCompileFlags.cmake
@@ -0,0 +1,21 @@
+# - MACRO_ADD_COMPILE_FLAGS(target_name flag1 ... flagN)
+
+# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
+# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+macro (MACRO_ADD_COMPILE_FLAGS _target)
+
+ get_target_property(_flags ${_target} COMPILE_FLAGS)
+ if (_flags)
+ set(_flags ${_flags} ${ARGN})
+ else (_flags)
+ set(_flags ${ARGN})
+ endif (_flags)
+
+ set_target_properties(${_target} PROPERTIES COMPILE_FLAGS ${_flags})
+
+endmacro (MACRO_ADD_COMPILE_FLAGS)
diff --git a/cmake/Modules/MacroAddLinkFlags.cmake b/cmake/Modules/MacroAddLinkFlags.cmake
new file mode 100644
index 0000000..91cad30
--- /dev/null
+++ b/cmake/Modules/MacroAddLinkFlags.cmake
@@ -0,0 +1,20 @@
+# - MACRO_ADD_LINK_FLAGS(target_name flag1 ... flagN)
+
+# Copyright (c) 2006, Oswald Buddenhagen, <ossi@kde.org>
+# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro (MACRO_ADD_LINK_FLAGS _target)
+
+ get_target_property(_flags ${_target} LINK_FLAGS)
+ if (_flags)
+ set(_flags "${_flags} ${ARGN}")
+ else (_flags)
+ set(_flags "${ARGN}")
+ endif (_flags)
+
+ set_target_properties(${_target} PROPERTIES LINK_FLAGS "${_flags}")
+
+endmacro (MACRO_ADD_LINK_FLAGS)
diff --git a/cmake/Modules/MacroAddPlugin.cmake b/cmake/Modules/MacroAddPlugin.cmake
new file mode 100644
index 0000000..36b5e57
--- /dev/null
+++ b/cmake/Modules/MacroAddPlugin.cmake
@@ -0,0 +1,30 @@
+# - MACRO_ADD_PLUGIN(name [WITH_PREFIX] file1 .. fileN)
+#
+# Create a plugin from the given source files.
+# If WITH_PREFIX is given, the resulting plugin will have the
+# prefix "lib", otherwise it won't.
+#
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+# Copyright (c) 2006, Laurent Montel, <montel@kde.org>
+# Copyright (c) 2006, Andreas Schneider, <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+macro (MACRO_ADD_PLUGIN _target_NAME _with_PREFIX)
+
+ if (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ set(_first_SRC)
+ else (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+ set(_first_SRC ${_with_PREFIX})
+ endif (${_with_PREFIX} STREQUAL "WITH_PREFIX")
+
+ add_library(${_target_NAME} MODULE ${_first_SRC} ${ARGN})
+
+ if (_first_SRC)
+ set_target_properties(${_target_NAME} PROPERTIES PREFIX "")
+ endif (_first_SRC)
+
+endmacro (MACRO_ADD_PLUGIN _name _sources)
+
diff --git a/cmake/Modules/MacroCopyFile.cmake b/cmake/Modules/MacroCopyFile.cmake
new file mode 100644
index 0000000..cee1cae
--- /dev/null
+++ b/cmake/Modules/MacroCopyFile.cmake
@@ -0,0 +1,33 @@
+# - macro_copy_file(_src _dst)
+# Copies a file to ${_dst} only if ${_src} is different (newer) than ${_dst}
+#
+# Example:
+# macro_copy_file(${CMAKE_CURRENT_SOURCE_DIR}/icon.png ${CMAKE_CURRENT_BINARY_DIR}/.)
+# Copies file icon.png to ${CMAKE_CURRENT_BINARY_DIR} directory
+#
+# Copyright (c) 2006-2007 Wengo
+# Copyright (c) 2006-2008 Andreas Schneider <mail@cynapses.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING file.
+
+
+macro (macro_copy_file _src _dst)
+ # Removes all path containing .svn or CVS or CMakeLists.txt during the copy
+ if (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
+
+ if (CMAKE_VERBOSE_MAKEFILE)
+ message(STATUS "Copy file from ${_src} to ${_dst}")
+ endif (CMAKE_VERBOSE_MAKEFILE)
+
+ # Creates directory if necessary
+ get_filename_component(_path ${_dst} PATH)
+ file(MAKE_DIRECTORY ${_path})
+
+ execute_process(
+ COMMAND
+ ${CMAKE_COMMAND} -E copy_if_different ${_src} ${_dst}
+ OUTPUT_QUIET
+ )
+ endif (NOT ${_src} MATCHES ".*\\.svn|CVS|CMakeLists\\.txt.*")
+endmacro (macro_copy_file)
diff --git a/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake b/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
new file mode 100644
index 0000000..a2e9480
--- /dev/null
+++ b/cmake/Modules/MacroEnsureOutOfSourceBuild.cmake
@@ -0,0 +1,17 @@
+# - MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
+# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+macro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage)
+
+ string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource)
+ if (_insource)
+ message(SEND_ERROR "${_errorMessage}")
+ message(FATAL_ERROR "Remove the file CMakeCache.txt in ${CMAKE_SOURCE_DIR} first.")
+ endif (_insource)
+
+endmacro (MACRO_ENSURE_OUT_OF_SOURCE_BUILD)
diff --git a/cmake/Modules/UseDoxygen.cmake b/cmake/Modules/UseDoxygen.cmake
new file mode 100644
index 0000000..3eb9490
--- /dev/null
+++ b/cmake/Modules/UseDoxygen.cmake
@@ -0,0 +1,127 @@
+# -helper macro to add a "doc" target with CMake build system.
+# and configure doxy.config.in to doxy.config
+#
+# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
+# Creates .chm windows help file if MS HTML help workshop
+# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
+# is installed with its DLLs in PATH.
+#
+#
+# Please note, that the tools, e.g.:
+# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
+# must be in path.
+#
+# Note about Visual Studio Projects:
+# MSVS has its own path environment which may differ from the shell.
+# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
+#
+# author Jan Woetzel 2004-2006
+# www.mip.informatik.uni-kiel.de/~jw
+
+
+FIND_PACKAGE(Doxygen)
+
+IF (DOXYGEN_FOUND)
+
+ # click+jump in Emacs and Visual Studio (for doxy.config) (jw)
+ IF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
+ SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
+ ELSE (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
+ SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
+ ENDIF (CMAKE_BUILD_TOOL MATCHES "(msdev|devenv)")
+
+ # we need latex for doxygen because of the formulas
+ FIND_PACKAGE(LATEX)
+ IF (NOT LATEX_COMPILER)
+ MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
+ ENDIF (NOT LATEX_COMPILER)
+ IF (NOT MAKEINDEX_COMPILER)
+ MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
+ ENDIF (NOT MAKEINDEX_COMPILER)
+ IF (NOT DVIPS_CONVERTER)
+ MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
+ ENDIF (NOT DVIPS_CONVERTER)
+ FIND_PROGRAM(DOXYGEN_DOT_EXECUTABLE_PATH NAMES dot)
+ IF (DOXYGEN_DOT_EXECUTABLE_PATH)
+ SET(DOXYGEN_DOT_FOUND "YES")
+ ENDIF (DOXYGEN_DOT_EXECUTABLE_PATH)
+
+ IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
+ MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in
+ ${CMAKE_CURRENT_BINARY_DIR}/doxy.config
+ @ONLY )
+ # use (configured) doxy.config from (out of place) BUILD tree:
+ SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
+ ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
+ # use static hand-edited doxy.config from SOURCE tree:
+ SET(DOXY_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
+ IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
+ MESSAGE(STATUS "WARNING: using existing ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config instead of configuring from doxy.config.in file.")
+ ELSE (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
+ IF (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
+ # using template doxy.config.in
+ MESSAGE(STATUS "Generate ${CMAKE_CURRENT_BINARY_DIR}/doxy.config from doxy.config.in")
+ CONFIGURE_FILE(${CMAKE_MODULE_PATH}/doxy.config.in
+ ${CMAKE_CURRENT_BINARY_DIR}/doxy.config
+ @ONLY )
+ SET(DOXY_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/doxy.config")
+ ELSE (EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
+ # failed completely...
+ MESSAGE(SEND_ERROR "Please create ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in (or doxy.config as fallback)")
+ ENDIF(EXISTS "${CMAKE_MODULE_PATH}/doxy.config.in")
+
+ ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config")
+ ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in")
+
+ ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
+
+ # create a windows help .chm file using hhc.exe
+ # HTMLHelp DLL must be in path!
+ # fallback: use hhw.exe interactively
+ IF (WIN32)
+ FIND_PACKAGE(HTMLHelp)
+ IF (HTML_HELP_COMPILER)
+ SET (TMP "${CMAKE_CURRENT_BINARY_DIR}\\doc\\html\\index.hhp")
+ STRING(REGEX REPLACE "[/]" "\\\\" HHP_FILE ${TMP} )
+ # MESSAGE(SEND_ERROR "DBG HHP_FILE=${HHP_FILE}")
+ ADD_CUSTOM_TARGET(winhelp ${HTML_HELP_COMPILER} ${HHP_FILE})
+ ADD_DEPENDENCIES (winhelp doc)
+
+ IF (NOT TARGET_DOC_SKIP_INSTALL)
+ # install windows help?
+ # determine useful name for output file
+ # should be project and version unique to allow installing
+ # multiple projects into one global directory
+ IF (EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
+ IF (PROJECT_NAME)
+ SET(OUT "${PROJECT_NAME}")
+ ELSE (PROJECT_NAME)
+ SET(OUT "Documentation") # default
+ ENDIF(PROJECT_NAME)
+ IF (${PROJECT_NAME}_VERSION_MAJOR)
+ SET(OUT "${OUT}-${${PROJECT_NAME}_VERSION_MAJOR}")
+ IF (${PROJECT_NAME}_VERSION_MINOR)
+ SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_MINOR}")
+ IF (${PROJECT_NAME}_VERSION_PATCH)
+ SET(OUT "${OUT}.${${PROJECT_NAME}_VERSION_PATCH}")
+ ENDIF(${PROJECT_NAME}_VERSION_PATCH)
+ ENDIF(${PROJECT_NAME}_VERSION_MINOR)
+ ENDIF(${PROJECT_NAME}_VERSION_MAJOR)
+ # keep suffix
+ SET(OUT "${OUT}.chm")
+
+ #MESSAGE("DBG ${PROJECT_BINARY_DIR}/doc/html/index.chm \n${OUT}")
+ # create target used by install and package commands
+ INSTALL(FILES "${PROJECT_BINARY_DIR}/doc/html/index.chm"
+ DESTINATION "doc"
+ RENAME "${OUT}"
+ )
+ ENDIF(EXISTS "${PROJECT_BINARY_DIR}/doc/html/index.chm")
+ ENDIF(NOT TARGET_DOC_SKIP_INSTALL)
+
+ ENDIF(HTML_HELP_COMPILER)
+ # MESSAGE(SEND_ERROR "HTML_HELP_COMPILER=${HTML_HELP_COMPILER}")
+ ENDIF (WIN32)
+ENDIF(DOXYGEN_FOUND)
+