Debian Codegraph @

cmake/FindBotan.cmake

raw
1 # - Find botan
2 # Find the botan cryptographic library
3 #
4 # This module defines the following variables:
5 # Botan_FOUND - True if library and include directory are found
6 # If set to TRUE, the following are also defined:
7 # Botan_INCLUDE_DIRS - The directory where to find the header file
8 # Botan_LIBRARIES - Where to find the library file
9 #
10 # For convenience, these variables are also set. They have the same values
11 # than the variables above. The user can thus choose his/her preferred way
12 # to write them.
13 # Botan_LIBRARY
14 # Botan_INCLUDE_DIR
15 #
16 # This file is in the public domain
17
18 find_package(PkgConfig REQUIRED)
19
20 macro(FIND_BOTAN_IN_FS BOTAN_VER)
21 find_path(Botan_INCLUDE_DIRS NAMES botan/types.h
22 PATH_SUFFIXES ${BOTAN_VER}
23 DOC "The botan include directory")
24
25 find_library(Botan_LIBRARIES NAMES botan ${BOTAN_VER}
26 DOC "The botan library")
27
28 # Use some standard module to handle the QUIETLY and REQUIRED arguments, and
29 # set Botan_FOUND to TRUE if these two variables are set.
30 include(FindPackageHandleStandardArgs)
31 find_package_handle_standard_args(Botan REQUIRED_VARS Botan_LIBRARIES Botan_INCLUDE_DIRS)
32
33 if(Botan_FOUND)
34 set(Botan_LIBRARY ${Botan_LIBRARIES} CACHE INTERNAL "")
35 set(Botan_INCLUDE_DIR ${Botan_INCLUDE_DIRS} CACHE INTERNAL "")
36 set(Botan_FOUND ${Botan_FOUND} CACHE INTERNAL "")
37 endif()
38 endmacro()
39
40 pkg_check_modules(Botan botan-3)
41 if(NOT Botan_FOUND)
42 find_botan_in_fs(botan-3)
43 endif()
44
45 if(NOT Botan_FOUND)
46 pkg_check_modules(Botan botan-2)
47
48 if(NOT Botan_FOUND)
49 find_botan_in_fs(botan-2)
50 endif()
51 endif()
52
53 mark_as_advanced(Botan_INCLUDE_DIRS Botan_LIBRARIES)