biboumi: Update botan to version 3
The botan dependency has introduced a number of breaking changes with version 3, a couple of which impact biboumi as well This patch makes biboumi compatible with botan 3 and drops support for botan 2 at the same time As a consequence of the botan dependency update, C++ version has to be upgraded to C++ 20 https://botan.randombit.net/handbook/migration_guide.html
This commit is contained in:
@@ -5,40 +5,63 @@
|
||||
# BOTAN_FOUND - True if library and include directory are found
|
||||
# If set to TRUE, the following are also defined:
|
||||
# BOTAN_INCLUDE_DIRS - The directory where to find the header file
|
||||
# BOTAN_LIBRARIES - Where to find the library file
|
||||
#
|
||||
# For conveniance, these variables are also set. They have the same values
|
||||
# than the variables above. The user can thus choose his/her prefered way
|
||||
# to write them.
|
||||
# BOTAN_LIBRARY
|
||||
# BOTAN_INCLUDE_DIR
|
||||
# BOTAN_LIBRARIES - Where to find the library files
|
||||
#
|
||||
# This file is in the public domain
|
||||
# Copied and modified from
|
||||
# https://github.com/vistle/vistle/blob/master/cmake/Modules/FindBOTAN.cmake
|
||||
|
||||
include(FindPkgConfig)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
if(NOT BOTAN_FOUND)
|
||||
pkg_check_modules(BOTAN botan-2)
|
||||
set(BOTAN_VERSIONS botan-3)
|
||||
set(BOTAN_NAMES botan-3 botan)
|
||||
set(BOTAN_NAMES_DEBUG botand-3 botand)
|
||||
|
||||
find_path(
|
||||
BOTAN_INCLUDE_DIR
|
||||
NAMES botan/build.h
|
||||
PATH_SUFFIXES ${BOTAN_VERSIONS}
|
||||
DOC "The Botan include directory")
|
||||
if(BOTAN_INCLUDE_DIR)
|
||||
file(READ "${BOTAN_INCLUDE_DIR}/botan/build.h" build)
|
||||
string(REGEX MATCH "BOTAN_VERSION_MAJOR ([0-9]*)" _ ${build})
|
||||
set(BOTAN_VERSION_MAJOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "BOTAN_VERSION_MINOR ([0-9]*)" _ ${build})
|
||||
set(BOTAN_VERSION_MINOR ${CMAKE_MATCH_1})
|
||||
string(REGEX MATCH "BOTAN_VERSION_PATCH ([0-9]*)" _ ${build})
|
||||
set(BOTAN_VERSION_PATCH ${CMAKE_MATCH_1})
|
||||
set(BOTAN_VERSION "${BOTAN_VERSION_MAJOR}.${BOTAN_VERSION_MINOR}.${BOTAN_VERSION_PATCH}")
|
||||
endif()
|
||||
|
||||
if(NOT BOTAN_FOUND)
|
||||
find_path(BOTAN_INCLUDE_DIRS NAMES botan/botan.h
|
||||
PATH_SUFFIXES botan-2
|
||||
DOC "The botan include directory")
|
||||
|
||||
find_library(BOTAN_LIBRARIES NAMES botan botan-2
|
||||
DOC "The botan library")
|
||||
|
||||
# Use some standard module to handle the QUIETLY and REQUIRED arguments, and
|
||||
# set BOTAN_FOUND to TRUE if these two variables are set.
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(BOTAN REQUIRED_VARS BOTAN_LIBRARIES BOTAN_INCLUDE_DIRS)
|
||||
|
||||
if(BOTAN_FOUND)
|
||||
set(BOTAN_LIBRARY ${BOTAN_LIBRARIES} CACHE INTERNAL "")
|
||||
set(BOTAN_INCLUDE_DIR ${BOTAN_INCLUDE_DIRS} CACHE INTERNAL "")
|
||||
set(BOTAN_FOUND ${BOTAN_FOUND} CACHE INTERNAL "")
|
||||
endif()
|
||||
find_library(
|
||||
BOTAN_LIBRARY
|
||||
NAMES ${BOTAN_NAMES}
|
||||
PATH_SUFFIXES release/lib lib
|
||||
DOC "The Botan (release) library")
|
||||
if(MSVC)
|
||||
find_library(
|
||||
BOTAN_LIBRARY_DEBUG
|
||||
NAMES ${BOTAN_NAMES_DEBUG}
|
||||
PATH_SUFFIXES debug/lib lib
|
||||
DOC "The Botan debug library")
|
||||
find_package_handle_standard_args(
|
||||
BOTAN
|
||||
REQUIRED_VARS BOTAN_LIBRARY BOTAN_LIBRARY_DEBUG BOTAN_INCLUDE_DIR
|
||||
VERSION_VAR BOTAN_VERSION)
|
||||
else()
|
||||
find_package_handle_standard_args(
|
||||
BOTAN
|
||||
REQUIRED_VARS BOTAN_LIBRARY BOTAN_INCLUDE_DIR
|
||||
VERSION_VAR BOTAN_VERSION)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(BOTAN_INCLUDE_DIRS BOTAN_LIBRARIES)
|
||||
if(BOTAN_FOUND)
|
||||
set(BOTAN_INCLUDE_DIRS ${BOTAN_INCLUDE_DIR})
|
||||
if(MSVC)
|
||||
set(BOTAN_LIBRARIES optimized ${BOTAN_LIBRARY} debug ${BOTAN_LIBRARY_DEBUG})
|
||||
else()
|
||||
set(BOTAN_LIBRARIES ${BOTAN_LIBRARY})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(BOTAN_INCLUDE_DIR BOTAN_LIBRARY BOTAN_LIBRARY_DEBUG)
|
||||
|
||||
Reference in New Issue
Block a user