Debian Codegraph @

cmake/Modules/Findlibfido2.cmake

raw
1 # - Try to find libfido2
2 # Once done this will define
3 #
4 # LIBFIDO2_ROOT_DIR - Set this variable to the root installation of libfido2
5 #
6 # Read-Only variables:
7 # LIBFIDO2_FOUND - system has libfido2
8 # LIBFIDO2_INCLUDE_DIR - the libfido2 include directory
9 # LIBFIDO2_LIBRARIES - Link these to use libfido2
10 #
11 # The libfido2 library provides support for communicating
12 # with FIDO2/U2F devices over USB/NFC.
13 #
14 # Copyright (c) 2025 Praneeth Sarode <[email protected]>
15 #
16 # Redistribution and use is allowed according to the terms of the New
17 # BSD license.
18 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
19 #
20
21
22 set(_LIBFIDO2_ROOT_HINTS
23 $ENV{LIBFIDO2_ROOT_DIR}
24 ${LIBFIDO2_ROOT_DIR}
25 )
26
27 set(_LIBFIDO2_ROOT_PATHS
28 "$ENV{PROGRAMFILES}/libfido2"
29 )
30
31 set(_LIBFIDO2_ROOT_HINTS_AND_PATHS
32 HINTS ${_LIBFIDO2_ROOT_HINTS}
33 PATHS ${_LIBFIDO2_ROOT_PATHS}
34 )
35
36 find_path(LIBFIDO2_INCLUDE_DIR
37 NAMES
38 fido.h
39 HINTS
40 ${_LIBFIDO2_ROOT_HINTS_AND_PATHS}
41 PATH_SUFFIXES
42 include
43 )
44
45 find_library(LIBFIDO2_LIBRARY
46 NAMES
47 fido2
48 HINTS
49 ${_LIBFIDO2_ROOT_HINTS_AND_PATHS}
50 PATH_SUFFIXES
51 lib
52 lib64
53 )
54
55 set(LIBFIDO2_LIBRARIES
56 ${LIBFIDO2_LIBRARY}
57 )
58
59 include(FindPackageHandleStandardArgs)
60 find_package_handle_standard_args(libfido2 DEFAULT_MSG LIBFIDO2_LIBRARIES LIBFIDO2_INCLUDE_DIR)
61
62 # show the LIBFIDO2_INCLUDE_DIR and LIBFIDO2_LIBRARIES variables only in the advanced view
63 mark_as_advanced(LIBFIDO2_INCLUDE_DIR LIBFIDO2_LIBRARIES)