Warning, /frameworks/extra-cmake-modules/find-modules/FindLibcap.cmake is written in an unsupported language. File is not indexed.

0001 # SPDX-FileCopyrightText: 2014 Hrvoje Senjan <hrvoje.senjan@gmail.com>
0002 #
0003 # SPDX-License-Identifier: BSD-3-Clause
0004 
0005 #[=======================================================================[.rst:
0006 FindLibcap
0007 ----------
0008 Try to find the setcap binary and cap libraries
0009 
0010 This will define:
0011 
0012 ``Libcap_FOUND``
0013     system has the cap library and setcap binary
0014 ``Libcap_LIBRARIES``
0015     cap libraries to link against
0016 ``SETCAP_EXECUTABLE``
0017     path of the setcap binary
0018 
0019 In addition, the following targets are defined:
0020   ``Libcap::SetCapabilities``
0021 
0022 Since 5.80.0
0023 #]=======================================================================]
0024 
0025 find_program(SETCAP_EXECUTABLE NAMES setcap DOC "The setcap executable")
0026 
0027 find_library(Libcap_LIBRARIES NAMES cap DOC "The cap (capabilities) library")
0028 
0029 include(FindPackageHandleStandardArgs)
0030 find_package_handle_standard_args(Libcap FOUND_VAR Libcap_FOUND
0031                                       REQUIRED_VARS SETCAP_EXECUTABLE Libcap_LIBRARIES)
0032 
0033 if(Libcap_FOUND AND NOT TARGET Libcap::SetCapabilities)
0034     add_executable(Libcap::SetCapabilities IMPORTED)
0035     set_target_properties(Libcap::SetCapabilities PROPERTIES
0036         IMPORTED_LOCATION "${SETCAP_EXECUTABLE}"
0037     )
0038 endif()
0039 
0040 mark_as_advanced(SETCAP_EXECUTABLE Libcap_LIBRARIES)
0041 
0042 include(FeatureSummary)
0043 set_package_properties(Libcap PROPERTIES
0044     URL https://sites.google.com/site/fullycapable/
0045     DESCRIPTION "Capabilities are a measure to limit the omnipotence of the superuser.")