Fix some bugs when testing opensds ansible
[stor4nfv.git] / src / ceph / cmake / modules / FindNSPR.cmake
1 # - Try to find NSPR
2 # Once done this will define
3 #
4 #  NSPR_FOUND - system has NSPR
5 #  NSPR_INCLUDE_DIRS - the NSPR include directory
6 #  NSPR_LIBRARIES - Link these to use NSPR
7 #  NSPR_DEFINITIONS - Compiler switches required for using NSPR
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 (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)
18   # in cache already
19   set(NSPR_FOUND TRUE)
20 else (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)
21   find_package(PkgConfig)
22   if (PKG_CONFIG_FOUND)
23     pkg_check_modules(_NSPR nspr)
24   endif (PKG_CONFIG_FOUND)
25
26   find_path(NSPR_INCLUDE_DIR
27     NAMES
28       nspr.h
29     PATHS
30       ${_NSPR_INCLUDEDIR}
31       /usr/include
32       /usr/local/include
33       /opt/local/include
34       /sw/include
35     PATH_SUFFIXES
36       nspr4
37       nspr
38   )
39
40   find_library(PLDS4_LIBRARY
41     NAMES
42       plds4
43     PATHS
44       ${_NSPR_LIBDIR}
45       /usr/lib
46       /usr/local/lib
47       /opt/local/lib
48       /sw/lib
49   )
50
51   find_library(PLC4_LIBRARY
52     NAMES
53       plc4
54     PATHS
55       ${_NSPR_LIBDIR}
56       /usr/lib
57       /usr/local/lib
58       /opt/local/lib
59       /sw/lib
60   )
61
62   find_library(NSPR4_LIBRARY
63     NAMES
64       nspr4
65     PATHS
66       ${_NSPR_LIBDIR}
67       /usr/lib
68       /usr/local/lib
69       /opt/local/lib
70       /sw/lib
71   )
72
73   set(NSPR_INCLUDE_DIRS
74     ${NSPR_INCLUDE_DIR}
75   )
76
77   if (PLDS4_LIBRARY)
78     set(NSPR_LIBRARIES
79         ${NSPR_LIBRARIES}
80         ${PLDS4_LIBRARY}
81     )
82   endif (PLDS4_LIBRARY)
83
84   if (PLC4_LIBRARY)
85     set(NSPR_LIBRARIES
86         ${NSPR_LIBRARIES}
87         ${PLC4_LIBRARY}
88     )
89   endif (PLC4_LIBRARY)
90
91   if (NSPR4_LIBRARY)
92     set(NSPR_LIBRARIES
93         ${NSPR_LIBRARIES}
94         ${NSPR4_LIBRARY}
95     )
96   endif (NSPR4_LIBRARY)
97
98   include(FindPackageHandleStandardArgs)
99   find_package_handle_standard_args(NSPR DEFAULT_MSG NSPR_LIBRARIES NSPR_INCLUDE_DIRS)
100
101   # show the NSPR_INCLUDE_DIRS and NSPR_LIBRARIES variables only in the advanced view
102   mark_as_advanced(NSPR_INCLUDE_DIRS NSPR_LIBRARIES)
103
104 endif (NSPR_LIBRARIES AND NSPR_INCLUDE_DIRS)