From 460d0b402bac86221fd94f086ef88f94f584df1f Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Mon, 2 Feb 2009 14:44:46 +0000 Subject: 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 --- CMakeLists.txt | 65 ++++++++++ CPackConfig.cmake | 27 +++++ ConfigureChecks.cmake | 48 ++++++++ DefineOptions.cmake | 1 + build/build_make.sh | 152 +++++++++++++++++++++++ cmake/Modules/COPYING-CMAKE-SCRIPTS | 22 ++++ cmake/Modules/DefineCMakeDefaults.cmake | 28 +++++ cmake/Modules/DefineCompilerFlags.cmake | 49 ++++++++ cmake/Modules/DefineInstallationPaths.cmake | 124 +++++++++++++++++++ cmake/Modules/FindGCrypt.cmake | 77 ++++++++++++ cmake/Modules/FindOpenSSL.cmake | 153 ++++++++++++++++++++++++ cmake/Modules/FindZLIB.cmake | 77 ++++++++++++ cmake/Modules/MacroAddCompileFlags.cmake | 21 ++++ cmake/Modules/MacroAddLinkFlags.cmake | 20 ++++ cmake/Modules/MacroAddPlugin.cmake | 30 +++++ cmake/Modules/MacroCopyFile.cmake | 33 +++++ cmake/Modules/MacroEnsureOutOfSourceBuild.cmake | 17 +++ cmake/Modules/UseDoxygen.cmake | 127 ++++++++++++++++++++ config.h.cmake | 75 ++++++++++++ include/CMakeLists.txt | 3 + include/libssh/CMakeLists.txt | 18 +++ libssh/CMakeLists.txt | 91 ++++++++++++++ 22 files changed, 1258 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 CPackConfig.cmake create mode 100644 ConfigureChecks.cmake create mode 100644 DefineOptions.cmake create mode 100644 build/build_make.sh create mode 100644 cmake/Modules/COPYING-CMAKE-SCRIPTS create mode 100644 cmake/Modules/DefineCMakeDefaults.cmake create mode 100644 cmake/Modules/DefineCompilerFlags.cmake create mode 100644 cmake/Modules/DefineInstallationPaths.cmake create mode 100644 cmake/Modules/FindGCrypt.cmake create mode 100644 cmake/Modules/FindOpenSSL.cmake create mode 100644 cmake/Modules/FindZLIB.cmake create mode 100644 cmake/Modules/MacroAddCompileFlags.cmake create mode 100644 cmake/Modules/MacroAddLinkFlags.cmake create mode 100644 cmake/Modules/MacroAddPlugin.cmake create mode 100644 cmake/Modules/MacroCopyFile.cmake create mode 100644 cmake/Modules/MacroEnsureOutOfSourceBuild.cmake create mode 100644 cmake/Modules/UseDoxygen.cmake create mode 100644 config.h.cmake create mode 100644 include/CMakeLists.txt create mode 100644 include/libssh/CMakeLists.txt create mode 100644 libssh/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..2caed71 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,65 @@ +project(libssh C) + +# Required cmake version +cmake_minimum_required(VERSION 2.6.0) + +# global needed variables +set(APPLICATION_NAME ${PROJECT_NAME}) + +set(APPLICATION_VERSION "0.3.0") + +set(APPLICATION_VERSION_MAJOR "0") +set(APPLICATION_VERSION_MINOR "3") +set(APPLICATION_VERSION_PATCH "0") + +set(LIBRARY_VERSION "3.0.0") +set(LIBRARY_SOVERSION "3") + +# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked +set(CMAKE_MODULE_PATH + ${CMAKE_SOURCE_DIR}/cmake/Modules +) + +# add definitions +include(DefineCMakeDefaults) +include(DefineCompilerFlags) +include(DefineInstallationPaths) +include(DefineOptions.cmake) +include(CPackConfig.cmake) + +# disallow in-source build +include(MacroEnsureOutOfSourceBuild) +macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of source build. Please create a separate build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there.") + +# add macros +include(MacroAddPlugin) +include(MacroCopyFile) + +# search for libraries +find_package(ZLIB REQUIRED) + +find_package(OpenSSL) + +if (NOT CRYPTO_FOUND) + find_package(GCrypt) + if (NOT GCRYPT_FOUND) + message(FATAL_ERROR "Could not find OpenSSL or GCrypt") + endif (NOT GCRYPT_FOUND) +endif (NOT CRYPTO_FOUND) + +# config.h checks +include(ConfigureChecks.cmake) +configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +# check subdirectories +add_subdirectory(include) +add_subdirectory(libssh) + +# build samples +include_directories(${CMAKE_SOURCE_DIR}/include) + +add_executable(samplessh sample.c) +add_executable(samplesshd samplesshd.c) + +target_link_libraries(samplessh ${LIBSSH_LIBRARY}) +target_link_libraries(samplesshd ${LIBSSH_LIBRARY}) diff --git a/CPackConfig.cmake b/CPackConfig.cmake new file mode 100644 index 0000000..2add0fb --- /dev/null +++ b/CPackConfig.cmake @@ -0,0 +1,27 @@ +include(InstallRequiredSystemLibraries) + +# For help take a look at: +# http://www.cmake.org/Wiki/CMake:CPackConfiguration + +### general settings +set(CPACK_PACKAGE_NAME ${APPLICATION_NAME}) +set(CPACK_PACKAGE_VENDOR "${APPLICATION_NAME} developers") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The SSH library") + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/COPYING") + +### versions +set(CPACK_PACKAGE_VERSION_MAJOR "0") +set(CPACK_PACKAGE_VERSION_MINOR "2") +set(CPACK_PACKAGE_VERSION_PATCH "90") +set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") + +set(CPACK_GENERATOR "TGZ") +set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +### source package settings +set(CPACK_SOURCE_GENERATOR "TGZ") +set(CPACK_SOURCE_IGNORE_FILES "~$;[.]swp$;/[.]svn/;/[.]git/;.gitignore;/build/;tags;cscope.*") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") + +include(CPack) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake new file mode 100644 index 0000000..9d81d51 --- /dev/null +++ b/ConfigureChecks.cmake @@ -0,0 +1,48 @@ +include(CheckIncludeFile) +include(CheckSymbolExists) +include(CheckFunctionExists) +include(CheckLibraryExists) +include(CheckTypeSize) +include(CheckCXXSourceCompiles) + +set(PACKAGE ${APPLICATION_NAME}) +set(VERSION ${APPLICATION_VERSION}) +set(DATADIR ${DATA_INSTALL_DIR}) +set(LIBDIR ${LIB_INSTALL_DIR}) +set(PLUGINDIR "${PLUGIN_INSTALL_DIR}-${LIBRARY_SOVERSION}") +set(SYSCONFDIR ${SYSCONF_INSTALL_DIR}) + +set(BINARYDIR ${CMAKE_BINARY_DIR}) +set(SOURCEDIR ${CMAKE_SOURCE_DIR}) + +# HEADER FILES +check_include_file(pty.h HAVE_PTY_H) +check_include_file(terminos.h HAVE_TERMIOS_H) + +check_include_file(openssl/aes.h HAVE_OPENSSL_AES_H) +check_include_file(openssl/blowfish.h HAVE_OPENSSL_BLOWFISH_H) +check_include_file(openssl/des.h HAVE_OPENSSL_DES_H) + +# FUNCTIONS +check_function_exists(cfmakeraw HAVE_CFMAKERAW) +check_function_exists(getaddrinfo HAVE_GETADDRINFO) +check_function_exists(gethostbyname HAVE_GETHOSTBYNAME) +check_function_exists(poll HAVE_POLL) +check_function_exists(select HAVE_SELECT) + +# LIBRARIES +if (CRYPTO_LIBRARY) + set(HAVE_LIBCRYPTO 1) +endif (CRYPTO_LIBRARY) + +if (GCRYPT_LIBRARY) + set(HAVE_LIBGCRYPT 1) +endif (GCRYPT_LIBRARY) + +if (ZLIB_LIBRARY) + set(HAVE_ZLIB 1) +endif (ZLIB_LIBRARY) + +if (WITH_SSH1) + set(HAVE_SSH1 1) +endif (WITH_SSH1) diff --git a/DefineOptions.cmake b/DefineOptions.cmake new file mode 100644 index 0000000..4463574 --- /dev/null +++ b/DefineOptions.cmake @@ -0,0 +1 @@ +option(WITH_SSH1 "Build with SSH1 support" OFF) diff --git a/build/build_make.sh b/build/build_make.sh new file mode 100644 index 0000000..04a310a --- /dev/null +++ b/build/build_make.sh @@ -0,0 +1,152 @@ +#!/bin/bash +# +# Last Change: 2008-06-18 14:13:46 +# +# Script to build libssh on UNIX. +# +# Copyright (c) 2006-2007 Andreas Schneider +# + +SOURCE_DIR=".." + +LANG=C +export LANG + +SCRIPT="$0" +COUNT=0 +while [ -L "${SCRIPT}" ] +do + SCRIPT=$(readlink ${SCRIPT}) + COUNT=$(expr ${COUNT} + 1) + if [ ${COUNT} -gt 100 ]; then + echo "Too many symbolic links" + exit 1 + fi +done +BUILDDIR=$(dirname ${SCRIPT}) + +cleanup_and_exit () { + if test "$1" = 0 -o -z "$1" ; then + exit 0 + else + exit $1 + fi +} + +function configure() { + cmake "$@" ${SOURCE_DIR} || cleanup_and_exit $? +} + +function compile() { + CPUCOUNT=$(grep -c processor /proc/cpuinfo) + if [ "${CPUCOUNT}" -gt "1" ]; then + make -j${CPUCOUNT} $1 || cleanup_and_exit $? + else + make $1 || exit $? + fi +} + +function clean_build_dir() { + find ! -path "*.svn*" ! -name "*.bat" ! -name "*.sh" ! -name "." -print0 | xargs -0 rm -rf +} + +function usage () { +echo "Usage: `basename $0` [--prefix /install_prefix|--build [debug|final]|--clean|--verbose|--libsuffix (32|64)|--help]" + cleanup_and_exit +} + +cd ${BUILDDIR} + +OPTIONS="--graphviz=${BUILDDIR}/libssh.dot -DUNIT_TESTING=ON" + +while test -n "$1"; do + PARAM="$1" + ARG="$2" + shift + case ${PARAM} in + *-*=*) + ARG=${PARAM#*=} + PARAM=${PARAM%%=*} + set -- "----noarg=${PARAM}" "$@" + esac + case ${PARAM} in + *-help|-h) + #echo_help + usage + cleanup_and_exit + ;; + *-build) + DOMAKE="1" + BUILD_TYPE="${ARG}" + test -n "${BUILD_TYPE}" && shift + ;; + *-clean) + clean_build_dir + cleanup_and_exit + ;; + *-verbose) + DOVERBOSE="1" + ;; + *-memtest) + OPTIONS="${OPTIONS} -DMEM_NULL_TESTS=ON" + ;; + *-libsuffix) + OPTIONS="${OPTIONS} -DLIB_SUFFIX=${ARG}" + shift + ;; + *-prefix) + OPTIONS="${OPTIONS} -DCMAKE_INSTALL_PREFIX=${ARG}" + shift + ;; + *-sysconfdir) + OPTIONS="${OPTIONS} -DSYSCONF_INSTALL_DIR=${ARG}" + shift + ;; + ----noarg) + echo "$ARG does not take an argument" + cleanup_and_exit + ;; + -*) + echo Unknown Option "$PARAM". Exit. + cleanup_and_exit 1 + ;; + *) + usage + ;; + esac +done + +if [ ${DOMAKE} -eq 1 ]; then + OPTIONS="${OPTIONS} -DCMAKE_BUILD_TYPE=${BUILD_TYPE}" +fi + +if [ -n "${DOVERBOSE}" ]; then + OPTIONS="${OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=1" +else + OPTIONS="${OPTIONS} -DCMAKE_VERBOSE_MAKEFILE=0" +fi + +test -f "${BUILDDIR}/.build.log" && rm -f ${BUILDDIR}/.build.log +touch ${BUILDDIR}/.build.log +# log everything from here to .build.log +exec 1> >(exec -a 'build logging tee' tee -a ${BUILDDIR}/.build.log) 2>&1 +echo "${HOST} started build at $(date)." +echo + +configure ${OPTIONS} "$@" + +if [ -n "${DOMAKE}" ]; then + test -n "${DOVERBOSE}" && compile VERBOSE=1 || compile +fi + +DOT=$(which dot 2>/dev/null) +if [ -n "${DOT}" ]; then + ${DOT} -Tpng -o${BUILDDIR}/libssh.png ${BUILDDIR}/libssh.dot + ${DOT} -Tsvg -o${BUILDDIR}/libssh.svg ${BUILDDIR}/libssh.dot +fi + +exec >&0 2>&0 # so that the logging tee finishes +sleep 1 # wait till tee terminates + +cleanup_and_exit 0 + 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 +# +# 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 +# +# 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 +# +# 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, +# Copyright (c) 2006, Andreas Schneider, +# +# 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, +# Copyright (c) 2006, Andreas Schneider, +# +# 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, +# Copyright (c) 2006, Laurent Montel, +# Copyright (c) 2006, Andreas Schneider, +# +# 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 +# +# 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() +# MACRO_ENSURE_OUT_OF_SOURCE_BUILD() + +# Copyright (c) 2006, Alexander Neundorf, +# +# 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) + diff --git a/config.h.cmake b/config.h.cmake new file mode 100644 index 0000000..f805825 --- /dev/null +++ b/config.h.cmake @@ -0,0 +1,75 @@ +/* Name of package */ +#cmakedefine PACKAGE "${APPLICATION_NAME}" + +/* Version number of package */ +#cmakedefine VERSION "${APPLICATION_VERSION}" + +#cmakedefine LOCALEDIR "${LOCALE_INSTALL_DIR}" +#cmakedefine DATADIR "${DATADIR}" +#cmakedefine LIBDIR "${LIBDIR}" +#cmakedefine PLUGINDIR "${PLUGINDIR}" +#cmakedefine SYSCONFDIR "${SYSCONFDIR}" +#cmakedefine BINARYDIR "${BINARYDIR}" +#cmakedefine SOURCEDIR "${SOURCEDIR}" + +/************************** HEADER FILES *************************/ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PTY_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_AES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_BLOWFISH_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_OPENSSL_DES_H 1 + +/*************************** FUNCTIONS ***************************/ + +/* Define to 1 if you have the `cfmakeraw' function. */ +#cmakedefine HAVE_CFMAKERAW 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#cmakedefine HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `gethostbyname' function. */ +#cmakedefine HAVE_GETHOSTBYNAME 1 + +/* Define to 1 if you have the `poll' function. */ +#cmakedefine HAVE_POLL 1 + +/* Define to 1 if you have the `select' function. */ +#cmakedefine HAVE_SELECT 1 + +/*************************** LIBRARIES ***************************/ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#cmakedefine HAVE_LIBCRYPTO 1 + +/* Define to 1 if you have the `gcrypt' library (-lgcrypt). */ +#cmakedefine HAVE_LIBGCRYPT 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#cmakedefine HAVE_LIBZ 1 + +/**************************** OPTIONS ****************************/ + +/* Define to 1 if you want to enable SSH1 */ +#cmakedefine HAVE_SSH1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..e480770 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,3 @@ +project(headers) + +add_subdirectory(libssh) diff --git a/include/libssh/CMakeLists.txt b/include/libssh/CMakeLists.txt new file mode 100644 index 0000000..3e1c3d5 --- /dev/null +++ b/include/libssh/CMakeLists.txt @@ -0,0 +1,18 @@ +project(libssh-headers) + +set(libssh_HDRS + libssh.h + crypto.h + server.h + sftp.h + ssh1.h + ssh2.h +) + +INSTALL( + FILES + ${libssh_HDRS} + DESTINATION + ${INCLUDE_INSTALL_DIR}/${APPLICATION_NAME} +) + diff --git a/libssh/CMakeLists.txt b/libssh/CMakeLists.txt new file mode 100644 index 0000000..8d74f96 --- /dev/null +++ b/libssh/CMakeLists.txt @@ -0,0 +1,91 @@ +project(libssh-library) + +set(LIBSSH_PUBLIC_INCLUDE_DIRS + ${CMAKE_SOURCE_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_SOURCE_DIR} + CACHE INTERNAL "libssh public include directories" +) + +set(LIBSSH_PRIVATE_INCLUDE_DIRS + ${CMAKE_BINARY_DIR} + ${OPENSSL_INCLUDE_DIRS} + ${GCRYPT_INCLUDE_DIRS} + ${ZLIB_INCLUDE_DIRS} +) + +set(LIBSSH_LIBRARY + libssh + CACHE INTERNAL "libssh library" +) + +set(LIBSSH_LINK_LIBRARIES + ${LIBSSH_LIBRARY} + ${CRYPTO_LIBRARY} + ${GCRYPT_LIBRARY} + ${ZLIB_LIBRARIES} +) + +set(libssh_SRCS + agent.c + auth1.c + auth.c + base64.c + buffer.c + channels1.c + channels.c + client.c + CMakeLists.txt + connect.c + crc32.c + crypt.c + dh.c + error.c + gcrypt_missing.c + gzip.c + init.c + kex.c + keyfiles.c + keys.c + libssh.vers + log.c + Makefile.am + match.c + messages.c + misc.c + options.c + packet.c + server.c + session.c + sftp.c + sftpserver.c + socket.c + string.c + wrapper.c +) + +include_directories( + ${LIBSSH_PUBLIC_INCLUDE_DIRS} + ${LIBSSH_PRIVATE_INCLUDE_DIRS} +) + +add_library(${LIBSSH_LIBRARY} SHARED ${libssh_SRCS}) + +target_link_libraries(${LIBSSH_LINK_LIBRARIES}) + +set_target_properties( + ${LIBSSH_LIBRARY} + PROPERTIES + VERSION + ${LIBRARY_VERSION} + SOVERSION + ${LIBRARY_SOVERSION} +) + +install( + TARGETS + ${LIBSSH_LIBRARY} + DESTINATION + ${LIB_INSTALL_DIR} +) + -- cgit