File: Find_openssl.cmake

package info (click to toggle)
crtmpserver 1.0~dfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,372 kB
  • ctags: 7,905
  • sloc: cpp: 56,355; sh: 411; makefile: 21
file content (104 lines) | stat: -rw-r--r-- 2,888 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
FIND_PATH(OPENSSL_INCLUDE_PATH 
	NAMES
		openssl/ssl.h
	PATHS
		/opt/local/include
		/usr/include
		/usr/local/include
		/sw/include
		/usr/local/ssl/include
		NO_DEFAULT_PATH)

IF($ENV{COMPILE_STATIC} MATCHES "1")
	SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES})
	SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .so .dylib ${CMAKE_FIND_LIBRARY_SUFFIXES})
ENDIF($ENV{COMPILE_STATIC} MATCHES "1")

FIND_LIBRARY(OPENSSL_LIBRARY_PATH
	NAMES
		ssl
	PATHS
		/opt/local/lib
		/usr/lib64
		/usr/lib
		/usr/local/lib64
		/usr/local/lib
		/sw/lib
		/usr/local/ssl/lib
		/lib
		)

FIND_LIBRARY(CRYPTO_LIBRARY_PATH
	NAMES
		crypto
	PATHS
		/opt/local/lib
		/usr/lib64
		/usr/lib
		/usr/local/lib64
		/usr/local/lib
		/sw/lib
		/usr/local/ssl/lib
		/lib
		)

IF($ENV{COMPILE_STATIC} MATCHES "1")
	FIND_LIBRARY(Z_LIBRARY_PATH
		NAMES
			z
		PATHS
			/opt/local/lib
			/usr/lib64
			/usr/lib
			/usr/local/lib64
			/usr/local/lib
			/sw/lib
			/usr/local/ssl/lib
			/lib
			NO_DEFAULT_PATH)
	SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD})
ELSEIF($ENV{COMPILE_STATIC} MATCHES "1")
	SET(Z_LIBRARY_PATH "")
ENDIF($ENV{COMPILE_STATIC} MATCHES "1")

MESSAGE("OPENSSL_INCLUDE_PATH: ${OPENSSL_INCLUDE_PATH}")
MESSAGE("OPENSSL_LIBRARY_PATH: ${OPENSSL_LIBRARY_PATH}")
MESSAGE("CRYPTO_LIBRARY_PATH: ${CRYPTO_LIBRARY_PATH}")
MESSAGE("Z_LIBRARY_PATH: ${Z_LIBRARY_PATH}")

IF(OPENSSL_INCLUDE_PATH)
	SET(OPENSSL_FOUND 1 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(STATUS "Looking for openssl headers - found")
ELSE(OPENSSL_INCLUDE_PATH)
	SET(OPENSSL_FOUND 0 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(FATAL_ERROR "Looking for openssl headers - not found")
ENDIF(OPENSSL_INCLUDE_PATH)

IF(OPENSSL_LIBRARY_PATH)
	SET(OPENSSL_FOUND 1 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(STATUS "Looking for openssl library - found")
ELSE(OPENSSL_LIBRARY_PATH)
	SET(OPENSSL_FOUND 0 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(FATAL_ERROR "Looking for openssl library - not found")
ENDIF(OPENSSL_LIBRARY_PATH)

IF(CRYPTO_LIBRARY_PATH)
	SET(OPENSSL_FOUND 1 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(STATUS "Looking for crypto library - found")
ELSE(CRYPTO_LIBRARY_PATH)
	SET(OPENSSL_FOUND 0 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
	MESSAGE(FATAL_ERROR "Looking for crypto library - not found")
ENDIF(CRYPTO_LIBRARY_PATH)

IF($ENV{COMPILE_STATIC} MATCHES "1")
	IF(Z_LIBRARY_PATH)
		SET(OPENSSL_FOUND 1 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
		MESSAGE(STATUS "Looking for z library - found")
	ELSE(Z_LIBRARY_PATH)
		SET(OPENSSL_FOUND 0 CACHE STRING "Set to 1 if openssl is found, 0 otherwise")
		MESSAGE(FATAL_ERROR "Looking for z library - not found")
	ENDIF(Z_LIBRARY_PATH)
ENDIF($ENV{COMPILE_STATIC} MATCHES "1")

MARK_AS_ADVANCED(OPENSSL_FOUND)