Permalink
Browse files

Replaced custom FindSSL.cmake with FindOpenSSL.cmake form cmake distr…

…o and added FindOpenGL.cmake for later use.
  • Loading branch information...
1 parent 0a3747c commit 3d07ac64fa6412db34a7f81f05f98362183deac4 @petrm petrm committed May 10, 2010
Showing with 266 additions and 25 deletions.
  1. +2 −2 addons/SecureSocket/CMakeLists.txt
  2. +159 −0 modules/FindOpenGL.cmake
  3. +105 −0 modules/FindOpenSSL.cmake
  4. +0 −23 modules/FindSSL.cmake
@@ -4,7 +4,7 @@
# Builds the SecureSocket addon
# Find SecureSocket
-find_package(SSL)
+find_package(OpenSSL)
# Create the _build bundle hierarchy if needed.
make_build_bundle(_build)
@@ -16,7 +16,7 @@ if(SSL_FOUND)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/_build/dll)
# Additional include directories
- include_directories(${SSL_INCLUDE_DIR}
+ include_directories(${OPENSSL_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../Socket/source)
# Generate the IoSecureSocketInit.c file.
View
@@ -0,0 +1,159 @@
+# - Try to find OpenGL
+# Once done this will define
+#
+# OPENGL_FOUND - system has OpenGL
+# OPENGL_XMESA_FOUND - system has XMESA
+# OPENGL_GLU_FOUND - system has GLU
+# OPENGL_INCLUDE_DIR - the GL include directory
+# OPENGL_LIBRARIES - Link these to use OpenGL and GLU
+#
+# If you want to use just GL you can use these values
+# OPENGL_gl_LIBRARY - Path to OpenGL Library
+# OPENGL_glu_LIBRARY - Path to GLU Library
+#
+# On OSX default to using the framework version of opengl
+# People will have to change the cache values of OPENGL_glu_LIBRARY
+# and OPENGL_gl_LIBRARY to use OpenGL with X11 on OSX
+
+#=============================================================================
+# Copyright 2001-2009 Kitware, Inc.
+#
+# 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.)
+
+IF (WIN32)
+ IF (CYGWIN)
+
+ FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h )
+
+ FIND_LIBRARY(OPENGL_gl_LIBRARY opengl32 )
+
+ FIND_LIBRARY(OPENGL_glu_LIBRARY glu32 )
+
+ ELSE (CYGWIN)
+
+ IF(BORLAND)
+ SET (OPENGL_gl_LIBRARY import32 CACHE STRING "OpenGL library for win32")
+ SET (OPENGL_glu_LIBRARY import32 CACHE STRING "GLU library for win32")
+ ELSE(BORLAND)
+ SET (OPENGL_gl_LIBRARY opengl32 CACHE STRING "OpenGL library for win32")
+ SET (OPENGL_glu_LIBRARY glu32 CACHE STRING "GLU library for win32")
+ ENDIF(BORLAND)
+
+ ENDIF (CYGWIN)
+
+ELSE (WIN32)
+
+ IF (APPLE)
+
+ FIND_LIBRARY(OPENGL_gl_LIBRARY OpenGL DOC "OpenGL lib for OSX")
+ FIND_LIBRARY(OPENGL_glu_LIBRARY AGL DOC "AGL lib for OSX")
+ FIND_PATH(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
+
+ ELSE(APPLE)
+ # Handle HP-UX cases where we only want to find OpenGL in either hpux64
+ # or hpux32 depending on if we're doing a 64 bit build.
+ IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ SET(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
+ ELSE(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ SET(HPUX_IA_OPENGL_LIB_PATH
+ /opt/graphics/OpenGL/lib/hpux64/
+ /opt/graphics/OpenGL/lib/pa20_64)
+ ENDIF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+
+ # The first line below is to make sure that the proper headers
+ # are used on a Linux machine with the NVidia drivers installed.
+ # They replace Mesa with NVidia's own library but normally do not
+ # install headers and that causes the linking to
+ # fail since the compiler finds the Mesa headers but NVidia's library.
+ # Make sure the NVIDIA directory comes BEFORE the others.
+ # - Atanas Georgiev <atanas@cs.columbia.edu>
+
+ FIND_PATH(OPENGL_INCLUDE_DIR GL/gl.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ )
+
+ FIND_PATH(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
+ /usr/share/doc/NVIDIA_GLX-1.0/include
+ /usr/openwin/share/include
+ /opt/graphics/OpenGL/include /usr/X11R6/include
+ )
+
+ FIND_LIBRARY(OPENGL_gl_LIBRARY
+ NAMES GL MesaGL
+ PATHS /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ ${HPUX_IA_OPENGL_LIB_PATH}
+ )
+
+ # On Unix OpenGL most certainly always requires X11.
+ # Feel free to tighten up these conditions if you don't
+ # think this is always true.
+ # It's not true on OSX.
+
+ IF (OPENGL_gl_LIBRARY)
+ IF(NOT X11_FOUND)
+ INCLUDE(FindX11)
+ ENDIF(NOT X11_FOUND)
+ IF (X11_FOUND)
+ IF (NOT APPLE)
+ SET (OPENGL_LIBRARIES ${X11_LIBRARIES})
+ ENDIF (NOT APPLE)
+ ENDIF (X11_FOUND)
+ ENDIF (OPENGL_gl_LIBRARY)
+
+ FIND_LIBRARY(OPENGL_glu_LIBRARY
+ NAMES GLU MesaGLU
+ PATHS ${OPENGL_gl_LIBRARY}
+ /opt/graphics/OpenGL/lib
+ /usr/openwin/lib
+ /usr/shlib /usr/X11R6/lib
+ )
+
+ ENDIF(APPLE)
+ENDIF (WIN32)
+
+SET( OPENGL_FOUND "NO" )
+IF(OPENGL_gl_LIBRARY)
+
+ IF(OPENGL_xmesa_INCLUDE_DIR)
+ SET( OPENGL_XMESA_FOUND "YES" )
+ ELSE(OPENGL_xmesa_INCLUDE_DIR)
+ SET( OPENGL_XMESA_FOUND "NO" )
+ ENDIF(OPENGL_xmesa_INCLUDE_DIR)
+
+ SET( OPENGL_LIBRARIES ${OPENGL_gl_LIBRARY} ${OPENGL_LIBRARIES})
+ IF(OPENGL_glu_LIBRARY)
+ SET( OPENGL_GLU_FOUND "YES" )
+ SET( OPENGL_LIBRARIES ${OPENGL_glu_LIBRARY} ${OPENGL_LIBRARIES} )
+ ELSE(OPENGL_glu_LIBRARY)
+ SET( OPENGL_GLU_FOUND "NO" )
+ ENDIF(OPENGL_glu_LIBRARY)
+
+ SET( OPENGL_FOUND "YES" )
+
+ # This deprecated setting is for backward compatibility with CMake1.4
+
+ SET (OPENGL_LIBRARY ${OPENGL_LIBRARIES})
+
+ENDIF(OPENGL_gl_LIBRARY)
+
+# This deprecated setting is for backward compatibility with CMake1.4
+SET(OPENGL_INCLUDE_PATH ${OPENGL_INCLUDE_DIR})
+
+MARK_AS_ADVANCED(
+ OPENGL_INCLUDE_DIR
+ OPENGL_xmesa_INCLUDE_DIR
+ OPENGL_glu_LIBRARY
+ OPENGL_gl_LIBRARY
+)
View
@@ -0,0 +1,105 @@
+# - Try to find the OpenSSL encryption library
+# Once done this will define
+#
+# OPENSSL_FOUND - system has the OpenSSL library
+# OPENSSL_INCLUDE_DIR - the OpenSSL include directory
+# OPENSSL_LIBRARIES - The libraries needed to use OpenSSL
+
+#=============================================================================
+# Copyright 2006-2009 Kitware, Inc.
+# Copyright 2006 Alexander Neundorf <neundorf@kde.org>
+# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
+#
+# 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.)
+
+# http://www.slproweb.com/products/Win32OpenSSL.html
+FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/include"
+)
+
+IF(WIN32 AND NOT CYGWIN)
+ # MINGW should go here too
+ IF(MSVC)
+ # /MD and /MDd are the standard values - if someone 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
+ # TODO: handle /MT and static lib
+ # In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
+ # * MD for dynamic-release
+ # * MDd for dynamic-debug
+ # * MT for static-release
+ # * MTd for static-debug
+
+ # Implementation details:
+ # We are using the libraries located in the VC subdir instead of the parent directory eventhough :
+ # libeay32MD.lib is identical to ../libeay32.lib, and
+ # ssleay32MD.lib is identical to ../ssleay32.lib
+ FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+ )
+ FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+ )
+ FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssleay32 ssl
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+ )
+ FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssleay32 ssl
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC"
+ )
+ if( CMAKE_CONFIGURATION_TYPES OR CMAKE_BUILD_TYPE )
+ set( OPENSSL_LIBRARIES
+ optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE}
+ debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}
+ )
+ else()
+ set( OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} )
+ endif()
+ MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
+ MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
+ ELSEIF(MINGW)
+ # same player, for MingW
+ FIND_LIBRARY(LIB_EAY NAMES libeay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW"
+ )
+ FIND_LIBRARY(SSL_EAY NAMES ssleay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/MinGW"
+ )
+ MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
+ set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
+ ELSE(MSVC)
+ # Not sure what to pick for -say- intel, let's use the toplevel ones and hope someone report issues:
+ FIND_LIBRARY(LIB_EAY NAMES libeay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib"
+ )
+ FIND_LIBRARY(SSL_EAY NAMES ssleay32
+ PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib"
+ )
+ MARK_AS_ADVANCED(SSL_EAY LIB_EAY)
+ set( OPENSSL_LIBRARIES ${SSL_EAY} ${LIB_EAY} )
+ ENDIF(MSVC)
+ELSE(WIN32 AND NOT CYGWIN)
+
+ FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD)
+ FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto)
+ MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES)
+
+ SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES})
+
+ENDIF(WIN32 AND NOT CYGWIN)
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(OpenSSL DEFAULT_MSG
+ OPENSSL_LIBRARIES
+ OPENSSL_INCLUDE_DIR
+)
+
+MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+
View
@@ -1,23 +0,0 @@
-# Base Io build system
-# Written by Jeremy Tregunna <jeremy.tregunna@me.com>
-#
-# Find OpenSSL.
-
-FIND_PATH(SSL_INCLUDE_DIR openssl/ssl.h)
-
-SET(SSL_NAMES ${SSL_NAMES} ssl)
-FIND_LIBRARY(SSL_LIBRARY NAMES ${SSL_NAMES} PATH /usr/lib)
-
-IF(SSL_INCLUDE_DIR AND SSL_LIBRARY)
- SET(SSL_FOUND TRUE)
-ENDIF(SSL_INCLUDE_DIR AND SSL_LIBRARY)
-
-IF(SSL_FOUND)
- IF(NOT SSL_FIND_QUIETLY)
- MESSAGE(STATUS "Found SSL: ${SSL_LIBRARY}")
- ENDIF (NOT SSL_FIND_QUIETLY)
-ELSE(SSL_FOUND)
- IF(SSL_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "Could not find OpenSSL")
- ENDIF(SSL_FIND_REQUIRED)
-ENDIF (SSL_FOUND)

0 comments on commit 3d07ac6

Please sign in to comment.