summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindCAP.cmake
blob: 0ed69f671fbc70b9de4d6e18ae5e003e0c277054 (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
#
# - Find capabilities
# Find the native CAP includes and library
#
#  CAP_INCLUDE_DIRS - where to find cap.h, etc.
#  CAP_LIBRARIES    - List of libraries when using cap.
#  CAP_FOUND        - True if cap found.


IF (CAP_INCLUDE_DIRS)
  # Already in cache, be silent
  SET(CAP_FIND_QUIETLY TRUE)
ENDIF (CAP_INCLUDE_DIRS)

find_package(PkgConfig)
pkg_search_module(CAP libcap)

FIND_PATH(CAP_INCLUDE_DIR sys/capability.h
  HINTS ${CAP_INCLUDEDIR}
)

SET(CAP_NAMES cap)
FIND_LIBRARY(CAP_LIBRARY NAMES ${CAP_NAMES}
  HINTS ${CAP_LIBDIR}
)

# handle the QUIETLY and REQUIRED arguments and set CAP_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CAP DEFAULT_MSG CAP_LIBRARY CAP_INCLUDE_DIR)

IF(CAP_FOUND)
  SET( CAP_LIBRARIES ${CAP_LIBRARY} )
  SET( CAP_INCLUDE_DIRS ${CAP_INCLUDE_DIR} )
ELSE(CAP_FOUND)
  SET( CAP_LIBRARIES )
  SET( CAP_INCLUDE_DIRS )
ENDIF(CAP_FOUND)

MARK_AS_ADVANCED( CAP_LIBRARIES CAP_INCLUDE_DIRS )