diff options
author | Drew DeVault <ddevault@vistarmedia.com> | 2017-07-11 22:16:56 -0400 |
---|---|---|
committer | Drew DeVault <ddevault@vistarmedia.com> | 2017-07-11 22:16:56 -0400 |
commit | b08aa9fd35d650b15a5322bd1b6edea01f152f27 (patch) | |
tree | 26a5b75622d0a750478dee5c8a5d99f5b75846b6 /CMake/FindLibcap.cmake | |
parent | 7b9c330bc502f7ba4899872cc7d43de95ae5136e (diff) |
Revert "Merge pull request #27 from ascent12/meson"
This reverts commit 85805da021006697c85489c3e30717c2b807441c, reversing
changes made to 8189c64d7f07a756abf5a6189719f02b2f1af967.
Diffstat (limited to 'CMake/FindLibcap.cmake')
-rw-r--r-- | CMake/FindLibcap.cmake | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/CMake/FindLibcap.cmake b/CMake/FindLibcap.cmake new file mode 100644 index 00000000..b34e5e37 --- /dev/null +++ b/CMake/FindLibcap.cmake @@ -0,0 +1,56 @@ +#.rst: +# FindLibcap +# ------- +# +# Find Libcap library +# +# Try to find Libcap library. The following values are defined +# +# :: +# +# Libcap_FOUND - True if Libcap is available +# Libcap_INCLUDE_DIRS - Include directories for Libcap +# Libcap_LIBRARIES - List of libraries for Libcap +# Libcap_DEFINITIONS - List of definitions for Libcap +# +# and also the following more fine grained variables +# +# :: +# +# Libcap_VERSION +# Libcap_VERSION_MAJOR +# Libcap_VERSION_MINOR +# +#============================================================================= +# Copyright (c) 2017 Jerzi Kaminsky +# +# Distributed under the OSI-approved BSD License (the "License"); +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= + +include(FeatureSummary) +set_package_properties(Libcap PROPERTIES + URL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2" + DESCRIPTION "Library for getting and setting POSIX.1e capabilities") + +find_package(PkgConfig) +pkg_check_modules(PC_CAP QUIET Libcap) +find_library(Libcap_LIBRARIES NAMES cap HINTS ${PC_CAP_LIBRARY_DIRS}) +find_path(Libcap_INCLUDE_DIRS sys/capability.h HINTS ${PC_CAP_INCLUDE_DIRS}) + +set(Libcap_VERSION ${PC_CAP_VERSION}) +string(REPLACE "." ";" VERSION_LIST "${PC_CAP_VERSION}") + +LIST(LENGTH VERSION_LIST n) +if (n EQUAL 2) + list(GET VERSION_LIST 0 Libcap_VERSION_MAJOR) + list(GET VERSION_LIST 1 Libcap_VERSION_MINOR) +endif () + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Libcap DEFAULT_MSG Libcap_INCLUDE_DIRS Libcap_LIBRARIES) +mark_as_advanced(Libcap_INCLUDE_DIRS Libcap_LIBRARIES Libcap_DEFINITIONS + Libcap_VERSION Libcap_VERSION_MAJOR Libcap_VERSION_MICRO Libcap_VERSION_MINOR) |