Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / cmake / modules / FindNSS.cmake
1 # - Try to find NSS
2 # Once done this will define
3 #
4 #  NSS_FOUND - system has NSS
5 #  NSS_INCLUDE_DIRS - the NSS include directory
6 #  NSS_LIBRARIES - Link these to use NSS
7 #  NSS_DEFINITIONS - Compiler switches required for using NSS
8 #
9 #  Copyright (c) 2010 Andreas Schneider <asn@redhat.com>
10 #
11 #  Redistribution and use is allowed according to the terms of the New
12 #  BSD license.
13 #  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
14 #
15
16
17 if (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)
18   # in cache already
19   set(NSS_FOUND TRUE)
20 else (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)
21   find_package(PkgConfig)
22   if (PKG_CONFIG_FOUND)
23     pkg_check_modules(_NSS nss)
24   endif (PKG_CONFIG_FOUND)
25
26   find_path(NSS_INCLUDE_DIR
27     NAMES
28       pk11pub.h
29     PATHS
30       ${_NSS_INCLUDEDIR}
31       /usr/include
32       /usr/local/include
33       /opt/local/include
34       /sw/include
35       /usr/local/include/nss
36     PATH_SUFFIXES
37       nss3
38       nss
39   )
40
41   find_library(SSL3_LIBRARY
42     NAMES
43       ssl3
44     PATHS
45       ${_NSS_LIBDIR}
46       /usr/lib
47       /usr/local/lib
48       /opt/local/lib
49       /sw/lib
50   )
51
52   find_library(SMIME3_LIBRARY
53     NAMES
54       smime3
55     PATHS
56       ${_NSS_LIBDIR}
57       /usr/lib
58       /usr/local/lib
59       /opt/local/lib
60       /sw/lib
61   )
62
63   find_library(NSS3_LIBRARY
64     NAMES
65       nss3
66     PATHS
67       ${_NSS_LIBDIR}
68       /usr/lib
69       /usr/local/lib
70       /opt/local/lib
71       /sw/lib
72       /usr/lib/x86_64-linux-gnu
73   )
74
75   find_library(NSSUTIL3_LIBRARY
76     NAMES
77       nssutil3
78     PATHS
79       ${_NSS_LIBDIR}
80       /usr/lib
81       /usr/local/lib
82       /opt/local/lib
83       /sw/lib
84   )
85
86   set(NSS_INCLUDE_DIRS
87     ${NSS_INCLUDE_DIR}
88   )
89
90   if (SSL3_LIBRARY)
91     set(NSS_LIBRARIES
92         ${NSS_LIBRARIES}
93         ${SSL3_LIBRARY}
94     )
95   endif (SSL3_LIBRARY)
96
97   if (SMIME3_LIBRARY)
98     set(NSS_LIBRARIES
99         ${NSS_LIBRARIES}
100         ${SMIME3_LIBRARY}
101     )
102   endif (SMIME3_LIBRARY)
103
104   if (NSS3_LIBRARY)
105     set(NSS_LIBRARIES
106         ${NSS_LIBRARIES}
107         ${NSS3_LIBRARY}
108     )
109   endif (NSS3_LIBRARY)
110
111   if (NSSUTIL3_LIBRARY)
112     set(NSS_LIBRARIES
113         ${NSS_LIBRARIES}
114         ${NSSUTIL3_LIBRARY}
115     )
116   endif (NSSUTIL3_LIBRARY)
117
118   include(FindPackageHandleStandardArgs)
119   message(STATUS "NSS_LIBRARIES: ${NSS_LIBRARIES}")
120   message(STATUS "NSS_INCLUDE_DIRS: ${NSS_INCLUDE_DIRS}")
121   find_package_handle_standard_args(NSS DEFAULT_MSG NSS_LIBRARIES NSS_INCLUDE_DIRS)
122
123   # show the NSS_INCLUDE_DIRS and NSS_LIBRARIES variables only in the advanced view
124   mark_as_advanced(NSS_INCLUDE_DIRS NSS_LIBRARIES)
125
126 endif (NSS_LIBRARIES AND NSS_INCLUDE_DIRS)