summaryrefslogtreecommitdiffstats
path: root/contrib/cmake/FindEVENT.cmake
blob: a32dbdf63deccfb530f13b4e103f6ca2ea7957e6 (plain)
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
FIND_PATH(EVENT_INCLUDE_DIR event2/event.h
  PATH_SUFFIXES include
  PATHS
  /usr/local
  /usr
  /sw # Fink
  /opt/local # DarwinPorts
  /opt/csw # Blastwave
  /opt
  HINTS $ENV{EVENT_SRC}
)

FIND_LIBRARY(EVENT_LIBRARY_RELEASE
  NAMES event libevent
  HINTS $ENV{EVENT_SRC}/.libs/
)
if (EVENT_LIBRARY_RELEASE)
	list(APPEND EVENT_LIBRARY optimized ${EVENT_LIBRARY_RELEASE})
endif()

FIND_LIBRARY(EVENT_LIBRARY_DEBUG
  NAMES event_d libevent_d
  HINTS $ENV{EVENT_SRC}/.libs/
)
if (EVENT_LIBRARY_DEBUG)
	list(APPEND EVENT_LIBRARY debug ${EVENT_LIBRARY_DEBUG})
else()
	if (EVENT_LIBRARY_RELEASE)
		list(APPEND EVENT_LIBRARY debug ${EVENT_LIBRARY_RELEASE})
	endif()
endif()



FIND_LIBRARY(EVENT_SSL_LIBRARY_RELEASE
  NAMES event_openssl libevent_openssl
  HINTS $ENV{EVENT_SRC}/.libs/
)
if (EVENT_SSL_LIBRARY_RELEASE)
	list(APPEND EVENT_LIBRARY optimized ${EVENT_SSL_LIBRARY_RELEASE})
	SET(EVENT_SSL_FOUND ON)
endif()

FIND_LIBRARY(EVENT_SSL_LIBRARY_DEBUG
  NAMES event_openssl_d libevent_openssl_d
  HINTS $ENV{EVENT_SRC}/.libs/
)
if (EVENT_SSL_LIBRARY_DEBUG)
	list(APPEND EVENT_LIBRARY debug ${EVENT_SSL_LIBRARY_DEBUG})
else()
	if (EVENT_SSL_LIBRARY_RELEASE)
		list(APPEND EVENT_LIBRARY debug ${EVENT_SSL_LIBRARY_RELEASE})
	endif()
endif()



if (NOT WIN32)
	FIND_LIBRARY(EVENT_LIBRARY_THREADS
	  NAMES event_pthreads
	  HINTS $ENV{EVENT_SRC}/.libs/
	)
	list (APPEND EVENT_LIBRARY ${EVENT_LIBRARY_THREADS})
	
	FIND_LIBRARY(EVENT_LIBRARY_EXTRA
	  NAMES event_extra
	  HINTS $ENV{EVENT_SRC}/.libs/
	)
	list (APPEND EVENT_LIBRARY ${EVENT_LIBRARY_EXTRA})

	FIND_LIBRARY(EVENT_LIBRARY_CORE
	  NAMES event_core
	  HINTS $ENV{EVENT_SRC}/.libs/
	)
	list (APPEND EVENT_LIBRARY ${EVENT_LIBRARY_CORE})

endif()

#message(FATAL_ERROR "EVENT_SSL_FOUND: ${EVENT_SSL_FOUND}")

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(EVENT DEFAULT_MSG EVENT_LIBRARY EVENT_INCLUDE_DIR)
MARK_AS_ADVANCED(EVENT_LIBRARY EVENT_INCLUDE_DIR EVENT_SSL_FOUND)