diff options
author | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-11-13 05:28:59 +0400 |
---|---|---|
committer | Marc-André Moreau <marcandre.moreau@gmail.com> | 2011-11-13 05:28:59 +0400 |
commit | 04e3f5d60f76c99ec4b12553d1d40eee8dbd348e (patch) | |
tree | d4a0806f492555342899059d8d88826cc0a5547f | |
parent | 69328d17516f391605b729fc4932278a05710761 (diff) |
cmake: add detection of pthreads, gcrypt
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | cmake/FindGCRYPT.cmake | 34 | ||||
-rw-r--r-- | cmake/FindOptionalPackage.cmake | 51 | ||||
-rw-r--r-- | cmake/FindPTHREAD.cmake | 34 | ||||
-rw-r--r-- | config.h.in | 23 | ||||
-rw-r--r-- | remmina/CMakeLists.txt | 12 |
7 files changed, 159 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore index 7e15669e5..41e4e6568 100644 --- a/.gitignore +++ b/.gitignore @@ -15,7 +15,6 @@ Makefile.in aclocal.m4 _configs.sed config.h -config.h.in config.log config.status config.guess diff --git a/CMakeLists.txt b/CMakeLists.txt index 94e195c11..61c779d5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,8 @@ include(CheckCCompilerFlag) set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) +include(FindOptionalPackage) + if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() @@ -61,6 +63,16 @@ set(REMMINA_PLUGINDIR "${CMAKE_INSTALL_PREFIX}/share/remmina") configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +find_suggested_package(PTHREAD) +if(PTHREAD_FOUND) + add_definitions(-DHAVE_PTHREAD) +endif() + +find_suggested_package(GCRYPT) +if(GCRYPT_FOUND) + add_definitions(-DHAVE_GCRYPT) +endif() + add_subdirectory(remmina) add_subdirectory(remmina-plugins) #add_subdirectory(remmina-plugins-gnome) diff --git a/cmake/FindGCRYPT.cmake b/cmake/FindGCRYPT.cmake new file mode 100644 index 000000000..c390e2af1 --- /dev/null +++ b/cmake/FindGCRYPT.cmake @@ -0,0 +1,34 @@ +# Remmina - The GTK+ Remote Desktop Client +# +# Copyright (C) 2011 Marc-Andre Moreau +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307, USA. + +find_path(GCRYPT_INCLUDE_DIR NAMES gcrypt.h) + +find_library(GCRYPT_LIBRARY NAMES gcrypt) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(GCRYPT DEFAULT_MSG GCRYPT_LIBRARY GCRYPT_INCLUDE_DIR) + +if(GCRYPT_FOUND) + set(GCRYPT_LIBRARIES ${GCRYPT_LIBRARY}) + set(GCRYPT_INCLUDE_DIRS ${GCRYPT_INCLUDE_DIR}) +endif() + +mark_as_advanced(GCRYPT_INCLUDE_DIR GCRYPT_LIBRARY) + diff --git a/cmake/FindOptionalPackage.cmake b/cmake/FindOptionalPackage.cmake new file mode 100644 index 000000000..3e543bdc4 --- /dev/null +++ b/cmake/FindOptionalPackage.cmake @@ -0,0 +1,51 @@ +# - FindOptionalPackage +# Enable or disable optional packages. Also force optional packages. +# +# This module defines the following macros: +# find_required_package : find a required package, can not be disabled +# find_suggested_package : find a suggested package - required but can be disabled +# find_optional_package : find an optional package - required only if enabled +# + +#============================================================================= +# Copyright 2011 Nils Andresen <nils@nils-andresen.de> +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#============================================================================= + +macro(find_required_package _normal_package) + find_package(${_normal_package} REQUIRED) +endmacro(find_required_package) + +macro(find_suggested_package _normal_package) + string(TOUPPER ${_normal_package} _upper_package) + option(WITH_${_upper_package} "Add dependency to ${_normal_package} - recommended" ON) + + if(WITH_${_upper_package}) + message(STATUS "Finding suggested package ${_normal_package}.") + message(STATUS " Disable this using \"-DWITH_${_upper_package}=OFF\".") + find_package(${_normal_package} REQUIRED) + endif(WITH_${_upper_package}) +endmacro(find_suggested_package) + +macro(find_optional_package _normal_package) + string(TOUPPER ${_normal_package} _upper_package) + option(WITH_${_upper_package} "Add dependency to ${_normal_package}" OFF) + + if(WITH_${_upper_package}) + find_package(${_normal_package} REQUIRED) + else(WITH_${_upper_package}) + message(STATUS "Skipping optional package ${_normal_package}.") + message(STATUS " Enable this using \"-DWITH_${_upper_package}=ON\".") + endif(WITH_${_upper_package}) +endmacro(find_optional_package) diff --git a/cmake/FindPTHREAD.cmake b/cmake/FindPTHREAD.cmake new file mode 100644 index 000000000..b9d78e8da --- /dev/null +++ b/cmake/FindPTHREAD.cmake @@ -0,0 +1,34 @@ +# Remmina - The GTK+ Remote Desktop Client +# +# Copyright (C) 2011 Marc-Andre Moreau +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, +# Boston, MA 02111-1307, USA. + +find_path(PTHREAD_INCLUDE_DIR NAMES pthread.h) + +find_library(PTHREAD_LIBRARY NAMES pthread) + +include(FindPackageHandleStandardArgs) + +find_package_handle_standard_args(PTHREAD DEFAULT_MSG PTHREAD_LIBRARY PTHREAD_INCLUDE_DIR) + +if(PTHREAD_FOUND) + set(PTHREAD_LIBRARIES ${PTHREAD_LIBRARY}) + set(PTHREAD_INCLUDE_DIRS ${PTHREAD_INCLUDE_DIR}) +endif() + +mark_as_advanced(PTHREAD_INCLUDE_DIR PTHREAD_LIBRARY) + diff --git a/config.h.in b/config.h.in new file mode 100644 index 000000000..93c93458e --- /dev/null +++ b/config.h.in @@ -0,0 +1,23 @@ +#ifndef __CONFIG_H +#define __CONFIG_H + +#cmakedefine HAVE_SYS_PARAM_H +#cmakedefine HAVE_SYS_SOCKET_H +#cmakedefine HAVE_ARPA_INET_H +#cmakedefine HAVE_NETINET_IN_H +#cmakedefine HAVE_TERMIOS_H +#cmakedefine HAVE_NETDB_H +#cmakedefine HAVE_FCNTL_H +#cmakedefine HAVE_UNISTD_H +#cmakedefine HAVE_SYS_UN_H +#cmakedefine HAVE_ERRNO_H + +#define remmina "remmina" +#define VERSION "${REMMINA_VERSION}" +#define GETTEXT_PACKAGE remmina + +#define REMMINA_DATADIR "${REMMINA_DATADIR}" +#define REMMINA_LOCALEDIR "${REMMINA_LOCALEDIR}" +#define REMMINA_PLUGINDIR "${REMMINA_PLUGINDIR}" + +#endif diff --git a/remmina/CMakeLists.txt b/remmina/CMakeLists.txt index 73f1f7c77..e7ada5c0d 100644 --- a/remmina/CMakeLists.txt +++ b/remmina/CMakeLists.txt @@ -90,15 +90,13 @@ set(REMMINA_SRCS add_executable(remmina ${REMMINA_SRCS}) -find_package(GTK3 REQUIRED) - +find_required_package(GTK3) if(GTK3_FOUND) - add_definitions(-DWITH_GTK3) include_directories(${GTK3_INCLUDE_DIRS}) target_link_libraries(remmina ${GTK3_LIBRARY_DIRS}) endif() -find_package(AVAHI) +find_suggested_package(AVAHI) if(AVAHI_FOUND) add_definitions(-DHAVE_LIBAVAHI_UI) add_definitions(-DHAVE_LIBAVAHI_CLIENT) @@ -106,21 +104,21 @@ if(AVAHI_FOUND) target_link_libraries(remmina ${AVAHI_LIBRARIES}) endif() -find_package(VTE) +find_suggested_package(VTE) if(VTE_FOUND) add_definitions(-DHAVE_LIBVTE) include_directories(${VTE_INCLUDE_DIRS}) target_link_libraries(remmina ${VTE_LIBRARIES}) endif() -find_package(SSH) +find_suggested_package(SSH) if(SSH_FOUND) add_definitions(-DHAVE_LIBSSH) include_directories(${SSH_INCLUDE_DIRS}) target_link_libraries(remmina ${SSH_LIBRARIES}) endif() -find_package(APPINDICATOR) +find_suggested_package(APPINDICATOR) if(APPINDICATOR_FOUND) add_definitions(-DHAVE_LIBAPPINDICATOR) include_directories(${APPINDICATOR_INCLUDE_DIRS}) |