1# Copyright 2019 Google LLC 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# https://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# On Debian, install libcap-dev to use this module. 16 17find_path(libcap_INCLUDE_DIR sys/capability.h) 18# Look for static library only. 19find_library(libcap_LIBRARY cap) 20mark_as_advanced(libcap_INCLUDE_DIR libcap_LIBRARY) 21 22include(FindPackageHandleStandardArgs) 23find_package_handle_standard_args(libcap 24 REQUIRED_VARS libcap_LIBRARY libcap_INCLUDE_DIR 25) 26 27if(libcap_FOUND AND NOT TARGET libcap::libcap) 28 add_library(libcap::libcap UNKNOWN IMPORTED) 29 set_target_properties(libcap::libcap PROPERTIES 30 IMPORTED_LINK_INTERFACE_LANGUAGES "C" 31 IMPORTED_LOCATION "${libcap_LIBRARY}" 32 INTERFACE_INCLUDE_DIRECTORIES "${libcap_INCLUDE_DIR}" 33 ) 34endif() 35