1 # - Try to find spdylay
2 # Once done this will define
3 # SPDYLAY_FOUND - System has spdylay
4 # SPDYLAY_INCLUDE_DIRS - The spdylay include directories
5 # SPDYLAY_LIBRARIES - The libraries needed to use spdylay
7 find_package(PkgConfig QUIET)
8 pkg_check_modules(PC_SPDYLAY QUIET libspdylay)
10 find_path(SPDYLAY_INCLUDE_DIR
11 NAMES spdylay/spdylay.h
12 HINTS ${PC_SPDYLAY_INCLUDE_DIRS}
14 find_library(SPDYLAY_LIBRARY
16 HINTS ${PC_SPDYLAY_LIBRARY_DIRS}
19 if(SPDYLAY_INCLUDE_DIR)
20 set(_version_regex "^#define[ \t]+SPDYLAY_VERSION[ \t]+\"([^\"]+)\".*")
21 file(STRINGS "${SPDYLAY_INCLUDE_DIR}/spdylay/spdylayver.h"
22 SPDYLAY_VERSION REGEX "${_version_regex}")
23 string(REGEX REPLACE "${_version_regex}" "\\1"
24 SPDYLAY_VERSION "${SPDYLAY_VERSION}")
28 include(FindPackageHandleStandardArgs)
29 # handle the QUIETLY and REQUIRED arguments and set SPDYLAY_FOUND to TRUE
30 # if all listed variables are TRUE and the requested version matches.
31 find_package_handle_standard_args(Spdylay REQUIRED_VARS
32 SPDYLAY_LIBRARY SPDYLAY_INCLUDE_DIR
33 VERSION_VAR SPDYLAY_VERSION)
36 set(SPDYLAY_LIBRARIES ${SPDYLAY_LIBRARY})
37 set(SPDYLAY_INCLUDE_DIRS ${SPDYLAY_INCLUDE_DIR})
40 mark_as_advanced(SPDYLAY_INCLUDE_DIR SPDYLAY_LIBRARY)