summaryrefslogtreecommitdiffstats
path: root/cmake/modules/FindCAP.cmake
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 20:34:10 +0000
commite4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc (patch)
tree68cb5ef9081156392f1dd62a00c6ccc1451b93df /cmake/modules/FindCAP.cmake
parentInitial commit. (diff)
downloadwireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.tar.xz
wireshark-e4ba6dbc3f1e76890b22773807ea37fe8fa2b1bc.zip
Adding upstream version 4.2.2.upstream/4.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/FindCAP.cmake')
-rw-r--r--cmake/modules/FindCAP.cmake40
1 files changed, 40 insertions, 0 deletions
diff --git a/cmake/modules/FindCAP.cmake b/cmake/modules/FindCAP.cmake
new file mode 100644
index 0000000..0ed69f6
--- /dev/null
+++ b/cmake/modules/FindCAP.cmake
@@ -0,0 +1,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 )