Warning, /plasma/powerdevil/cmake/FindLibcap.cmake is written in an unsupported language. File is not indexed.

0001 # Try to find the setcap binary and cap libraries
0002 #
0003 # This will define:
0004 #
0005 #   Libcap_FOUND           - system has the cap library and setcap binary
0006 #   Libcap_LIBRARIES       - cap libraries to link against
0007 #   SETCAP_EXECUTABLE      - path of the setcap binary
0008 # In addition, the following targets are defined:
0009 #
0010 #   Libcap::SetCapabilities
0011 #
0012 
0013 
0014 # Copyright (c) 2014, Hrvoje Senjan, <hrvoje.senjan@gmail.com>
0015 #
0016 # Redistribution and use in source and binary forms, with or without
0017 # modification, are permitted provided that the following conditions
0018 # are met:
0019 #
0020 # 1. Redistributions of source code must retain the copyright
0021 #    notice, this list of conditions and the following disclaimer.
0022 # 2. Redistributions in binary form must reproduce the copyright
0023 #    notice, this list of conditions and the following disclaimer in the
0024 #    documentation and/or other materials provided with the distribution.
0025 # 3. The name of the author may not be used to endorse or promote products
0026 #    derived from this software without specific prior written permission.
0027 #
0028 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
0029 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
0030 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0031 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0032 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
0033 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0034 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0035 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0036 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
0037 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0038 
0039 find_program(SETCAP_EXECUTABLE NAMES setcap DOC "The setcap executable")
0040 
0041 find_library(Libcap_LIBRARIES NAMES cap DOC "The cap (capabilities) library")
0042 
0043 include(FindPackageHandleStandardArgs)
0044 find_package_handle_standard_args(Libcap FOUND_VAR Libcap_FOUND
0045                                       REQUIRED_VARS SETCAP_EXECUTABLE Libcap_LIBRARIES)
0046 
0047 if(Libcap_FOUND AND NOT TARGET Libcap::SetCapabilities)
0048     add_executable(Libcap::SetCapabilities IMPORTED)
0049     set_target_properties(Libcap::SetCapabilities PROPERTIES
0050         IMPORTED_LOCATION "${SETCAP_EXECUTABLE}"
0051     )
0052 endif()
0053 
0054 mark_as_advanced(SETCAP_EXECUTABLE Libcap_LIBRARIES)
0055 
0056 include(FeatureSummary)
0057 set_package_properties(Libcap PROPERTIES
0058     URL https://sites.google.com/site/fullycapable/
0059     DESCRIPTION "Capabilities are a measure to limit the omnipotence of the superuser.")