Removed
Link Here
|
1 |
# - Find libCrypto |
2 |
# Find the native OpenSSL LIBCRYPTO includes and library |
3 |
# |
4 |
# LIBCRYPTO_INCLUDE_DIR - where to find sha.h, etc. |
5 |
# LIBCRYPTO_LIBRARIES - List of libraries when using libCrypto. |
6 |
# LIBCRYPTO_FOUND - True if libCrypto found. |
7 |
|
8 |
|
9 |
IF (LIBCRYPTO_INCLUDE_DIR) |
10 |
# Already in cache, be silent |
11 |
SET(LIBCRYPTO_FIND_QUIETLY TRUE) |
12 |
ENDIF (LIBCRYPTO_INCLUDE_DIR) |
13 |
|
14 |
IF (NOT LIBCRYPTO_INCLUDE_DIR OR NOT LIBCRYPTO_LIBRARIES) |
15 |
FIND_PACKAGE(PkgConfig) |
16 |
|
17 |
IF (PKG_CONFIG_FOUND) |
18 |
PKG_CHECK_MODULES (LIBCRYPTO libcrypto) |
19 |
IF (LIBCRYPTO_FOUND) |
20 |
SET (LIBCRYPTO_INCLUDE_DIR ${LIBCRYPTO_INCLUDE_DIRS}) |
21 |
ENDIF (LIBCRYPTO_FOUND) |
22 |
ENDIF (PKG_CONFIG_FOUND) |
23 |
ENDIF (NOT LIBCRYPTO_INCLUDE_DIR OR NOT LIBCRYPTO_LIBRARIES) |
24 |
|
25 |
IF (NOT LIBCRYPTO_INCLUDE_DIR OR NOT LIBCRYPTO_LIBRARIES) |
26 |
# Require a regular OpenSSL even on OSX/iOS |
27 |
# IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
28 |
# # MacOSX has deprecated the use of openssl crypto functions |
29 |
# # and replaced it with API-compatible CommonCrypto |
30 |
# FIND_PATH(LIBCRYPTO_INCLUDE_DIR CommonCrypto/CommonDigest.h) |
31 |
# SET(LIBCRYPTO_LIBRARY_NAMES_RELEASE ${LIBCRYPTO_LIBRARY_NAMES_RELEASE} ${LIBCRYPTO_LIBRARY_NAMES} ssl) |
32 |
# SET(LIBCRYPTO_LIBRARY_NAMES_DEBUG ${LIBCRYPTO_LIBRARY_NAMES_DEBUG} ssld) |
33 |
# ELSE(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
34 |
FIND_PATH(LIBCRYPTO_INCLUDE_DIR openssl/sha.h) |
35 |
SET(LIBCRYPTO_LIBRARY_NAMES_RELEASE ${LIBCRYPTO_LIBRARY_NAMES_RELEASE} ${LIBCRYPTO_LIBRARY_NAMES} crypto) |
36 |
SET(LIBCRYPTO_LIBRARY_NAMES_DEBUG ${LIBCRYPTO_LIBRARY_NAMES_DEBUG} cryptod) |
37 |
# ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
38 |
|
39 |
FIND_LIBRARY(LIBCRYPTO_LIBRARY_RELEASE NAMES ${LIBCRYPTO_LIBRARY_NAMES_RELEASE} ) |
40 |
|
41 |
# Find a debug library if one exists and use that for debug builds. |
42 |
# This really only does anything for win32, but does no harm on other |
43 |
# platforms. |
44 |
FIND_LIBRARY(LIBCRYPTO_LIBRARY_DEBUG NAMES ${LIBCRYPTO_LIBRARY_NAMES_DEBUG}) |
45 |
|
46 |
INCLUDE(LibraryDebugAndRelease) |
47 |
SET_LIBRARY_FROM_DEBUG_AND_RELEASE(LIBCRYPTO) |
48 |
|
49 |
# handle the QUIETLY and REQUIRED arguments and set LIBCRYPTO_FOUND to TRUE if |
50 |
# all listed variables are TRUE |
51 |
INCLUDE(FindPackageHandleStandardArgs) |
52 |
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBCRYPTO DEFAULT_MSG LIBCRYPTO_LIBRARY LIBCRYPTO_INCLUDE_DIR) |
53 |
|
54 |
IF(LIBCRYPTO_FOUND) |
55 |
SET( LIBCRYPTO_LIBRARIES ${LIBCRYPTO_LIBRARY} ) |
56 |
ELSE(LIBCRYPTO_FOUND) |
57 |
SET( LIBCRYPTO_LIBRARIES ) |
58 |
ENDIF(LIBCRYPTO_FOUND) |
59 |
|
60 |
MARK_AS_ADVANCED( LIBCRYPTO_LIBRARY LIBCRYPTO_INCLUDE_DIR ) |
61 |
|
62 |
ENDIF (NOT LIBCRYPTO_INCLUDE_DIR OR NOT LIBCRYPTO_LIBRARIES) |
63 |
|
64 |
# check whether using OpenSSL 1.1 API |
65 |
IF (DEFINED LIBCRYPTO_INCLUDE_DIR AND DEFINED LIBCRYPTO_LIBRARIES) |
66 |
INCLUDE(CheckCSourceCompiles) |
67 |
|
68 |
SET(CMAKE_REQUIRED_INCLUDES ${LIBCRYPTO_INCLUDE_DIR}) |
69 |
SET(CMAKE_REQUIRED_LIBRARIES ${LIBCRYPTO_LIBRARIES}) |
70 |
|
71 |
CHECK_C_SOURCE_COMPILES("#include <openssl/opensslv.h> |
72 |
#ifndef OPENSSL_VERSION_NUMBER |
73 |
#error No OPENSSL_VERSION_NUMBER defined |
74 |
#endif |
75 |
#if OPENSSL_VERSION_NUMBER < 0x10100000L |
76 |
#error This is not OpenSSL 1.1 or higher |
77 |
#endif |
78 |
int main(void) { return 0; }" PODOFO_HAVE_OPENSSL_1_1) |
79 |
|
80 |
CHECK_C_SOURCE_COMPILES("#include <openssl/opensslconf.h> |
81 |
#ifndef OPENSSL_NO_RC4 |
82 |
#error No OPENSSL_NO_RC4 defined |
83 |
#endif |
84 |
int main(void) { return 0; }" PODOFO_HAVE_OPENSSL_NO_RC4) |
85 |
|
86 |
UNSET(CMAKE_REQUIRED_INCLUDES) |
87 |
UNSET(CMAKE_REQUIRED_LIBRARIES) |
88 |
ENDIF (DEFINED LIBCRYPTO_INCLUDE_DIR AND DEFINED LIBCRYPTO_LIBRARIES) |