# $Id: CMakeLists.txt 2327 2008-01-27 15:51:39Z edmanm $ # # Vidalia is distributed under the following license: # # Copyright (C) 2006-2007, Matt Edman, Justin Hipple # Copyright (C) 2008, Matt Edman # # 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., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # # # This file incorporates work covered by the following copyright and # permission notice: # # Copyright (c) 2006, Alexander Neundorf, # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # # * Neither the names of the copyright owners nor the names of its # contributors may be used to endorse or promote products derived from this # software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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. # # Tries to find the required OpenSSL libraries. Once done this will define # the variable OPENSSL_LIBRARIES. message(STATUS "Looking for OpenSSL libraries") if (MSVC) # /MD and /MDd are the standard values - if somone wants to use # others, the libnames have to change here too # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b find_library(OPENSSL_LIBSSL_DEBUG NAMES ssleay32MDd ssl ssleay32 PATHS ${OPENSSL_LIBRARY_DIR} ) find_library(OPENSSL_LIBSSL_RELEASE NAMES ssleay32MD ssl ssleay32 PATHS ${OPENSSL_LIBRARY_DIR} ) find_library(OPENSSL_LIBCRYPTO_DEBUG NAMES libeay32MDd crypto libeay32 PATHS ${OPENSSL_LIBRARY_DIR} ) find_library(OPENSSL_LIBCRYPTO_RELEASE NAMES libeay32MD crypto libeay32 PATHS ${OPENSSL_LIBRARY_DIR} ) if (MSVC_IDE) if (NOT OPENSSL_LIBSSL_DEBUG OR NOT OPENSSL_LIBSSL_RELEASE) message(FATAL_ERROR "Could not find the debug and release version of libssl.") endif(NOT OPENSSL_LIBSSL_DEBUG OR NOT OPENSSL_LIBSSL_RELEASE) if (NOT OPENSSL_LIBCRYPTO_DEBUG OR NOT OPENSSL_LIBCRYPTO_RELEASE) message(FATAL_ERROR "Could not find the debug and release version of libcrypto.") endif(NOT OPENSSL_LIBCRYPTO_DEBUG OR NOT OPENSSL_LIBCRYPTO_RELEASE) set(OPENSSL_LIBSSL optimized ${OPENSSL_LIBSSL_RELEASE} debug ${OPENSSL_LIBSSL_DEBUG}) set(OPENSSL_LIBCRYPTO optimized ${OPENSSL_LIBCRYPTO_RELEASE} debug ${OPENSSL_LIBCRYPTO_DEBUG}) else(MSVC_IDE) string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) if (CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) set(OPENSSL_LIBSSL ${OPENSSL_LIBSSL_DEBUG}) set(OPENSSL_LIBCRYPTO ${OPENSSL_LIBCRYPTO_DEBUG}) else(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) set(OPENSSL_LIBSSL ${OPENSSL_LIBSSL_RELEASE}) set(OPENSSL_LIBCRYPTO ${OPENSSL_LIBCRYPTO_RELEASE}) endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) endif(MSVC_IDE) mark_as_advanced(OPENSSL_LIBSSL_DEBUG OPENSSL_LIBCRYPTO_DEBUG OPENSSL_LIBSSL_RELEASE OPENSSL_LIBCRYPTO_RELEASE) else(MSVC) find_library(OPENSSL_LIBSSL NAMES ssl ssleay32) find_library(OPENSSL_LIBCRYPTO NAMES crypto libeay32) endif(MSVC) if (OPENSSL_LIBSSL AND OPENSSL_LIBCRYPTO) set(OPENSSL_LIBRARIES ${OPENSSL_LIBSSL} ${OPENSSL_LIBCRYPTO}) mark_as_advanced(OPENSSL_LIBSSL OPENSSL_LIBCRYPTO) mark_as_advanced(OPENSSL_LIBRARIES) message(STATUS "Looking for OpenSSL libraries - found") else (OPENSSL_LIBSSL AND OPENSSL_LIBCRYPTO) if (NOT OPENSSL_LIBSSL) message(FATAL_ERROR "Could not find libssl.") else (NOT OPENSSL_LIBSSL) message(FATAL_ERROR "Could not find libcrypto.") endif (NOT OPENSSL_LIBSSL) endif(OPENSSL_LIBSSL AND OPENSSL_LIBCRYPTO)