Skip to content

Instantly share code, notes, and snippets.

@brimston3
Last active February 1, 2017 20:07
Show Gist options
  • Save brimston3/ad5c4a4271daf370f2b84f1a6e4b57c8 to your computer and use it in GitHub Desktop.
Save brimston3/ad5c4a4271daf370f2b84f1a6e4b57c8 to your computer and use it in GitHub Desktop.
CMake FindKeyutils module
# This module defines
# Keyutils_LIBRARIES, the name of the libraries to link against
# Keyutils_FOUND, if false, do not try to link keyutils
# Keyutils_INCLUDE_DIRS, where to find keyutils.h and dependent includes
#
# As keyutils is a Linux interface, paths for other OSes are not defined
#
# Copyright (c) 2017, Andrew Domaszek
#
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://opensource.org/licenses/BSD-3-Clause for
# details.
#.rst:
# FindKeyutils
# ------------
#
# This module finds the installed keyutils library.
#
# * KEYUTILSPATH: Override the search path used for locating files
# * Keyutils_FOUND: set to true if the library is found.
# * Keyutils_LIBRARIES: uncached list of libraries to link against to use keyutils
# * Keyutils_INCLUDE_DIRS: uncached list of include search directories to use keyutils
SET(KEYUTILS_SEARCH_PATHS
${KEYUTILSPATH}
$ENV{KEYUTILSPATH}
/usr/local
/usr
/opt/local
/opt
)
FIND_PATH(Keyutils_INCLUDE_DIR keyutils.h
HINTS $ENV{KEYUTILSDIR}
PATH_SUFFIXES include
PATHS ${KEYUTILS_SEARCH_PATHS}
)
FIND_LIBRARY(Keyutils_LIBRARY
NAMES
keyutils
PATH_SUFFIXES
lib64
lib
lib/x64
lib/x86
PATHS
${KEYUTILS_SEARCH_PATHS}
)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Keyutils
FOUND_VAR Keyutils_FOUND
REQUIRED_VARS
Keyutils_INCLUDE_DIR
Keyutils_LIBRARY
)
IF(Keyutils_FOUND)
set(Keyutils_LIBRARIES ${Keyutils_LIBRARY} )
set(Keyutils_INCLUDE_DIRS ${Keyutils_INCLUDE_DIR})
ENDIF()
MARK_AS_ADVANCED(
Keyutils_INCLUDE_DIR
Keyutils_LIBRARY
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment