| 1 |
# - Try to find SELinux |
| 2 |
# Once done, this will define |
| 3 |
# |
| 4 |
# SELINUX_FOUND - system has SELinux |
| 5 |
# SELINUX_INCLUDE_DIRS - the SELinux include directories |
| 6 |
# SELINUX_LIBRARIES - link these to use SELinux |
| 7 |
|
| 8 |
include(LibFindMacros) |
| 9 |
|
| 10 |
# Use pkg-config to get hints about paths |
| 11 |
libfind_pkg_check_modules(SELINUX_PKGCONF libselinux) |
| 12 |
|
| 13 |
# Include dir |
| 14 |
find_path(SELINUX_INCLUDE_DIR |
| 15 |
NAMES selinux/selinux.h |
| 16 |
PATHS ${SELINUX_PKGCONF_INCLUDE_DIRS} |
| 17 |
) |
| 18 |
|
| 19 |
# Finally the library itself |
| 20 |
find_library(SELINUX_LIBRARY |
| 21 |
NAMES selinux |
| 22 |
PATHS ${SELINUX_PKGCONF_LIBRARY_DIRS} |
| 23 |
) |
| 24 |
|
| 25 |
# Set the include dir variables and the libraries and let libfind_process do the rest. |
| 26 |
# NOTE: Singular variables for this library, plural for libraries this this lib depends on. |
| 27 |
set(SELINUX_PROCESS_INCLUDES SELINUX_INCLUDE_DIR) |
| 28 |
set(SELINUX_PROCESS_LIBS SELINUX_LIBRARY) |
| 29 |
libfind_process(SELINUX) |