diff --git a/chronik/CMakeLists.txt b/chronik/CMakeLists.txt --- a/chronik/CMakeLists.txt +++ b/chronik/CMakeLists.txt @@ -182,6 +182,10 @@ # rocksdb requires items from rpcdce.h, found in rpcrt4 find_package(RPCRT4 REQUIRED) target_link_libraries(chronik RPCRT4::rpcrt4) + + # Need bcrypt for BCryptGenRandom + find_package(Bcrypt REQUIRED) + target_link_libraries(chronik Bcrypt::bcrypt) endif() # Rocksdb requires "atomic" diff --git a/cmake/modules/FindBcrypt.cmake b/cmake/modules/FindBcrypt.cmake new file mode 100644 --- /dev/null +++ b/cmake/modules/FindBcrypt.cmake @@ -0,0 +1,41 @@ +# Copyright (c) 2022 The Bitcoin developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +# .rst: +# FindBcrypt +# -------------- +# +# Find the Bcrypt library. The following conponents are available:: +# bcrypt +# +# This will define the following variables:: +# +# Bcrypt_FOUND - True if the Bcrypt library is found. +# Bcrypt_INCLUDE_DIRSS - List of the header include directories. +# Bcrypt_LIBRARIES - List of the libraries. +# +# And the following imported targets: +# +# Bcrypt::bcrypt + +find_path(Bcrypt_INCLUDE_DIRS + NAMES bcrypt.h +) + +mark_as_advanced(Bcrypt_INCLUDE_DIRS) + +if(Bcrypt_INCLUDE_DIRS) + include(ExternalLibraryHelper) + find_component(Bcrypt bcrypt + NAMES bcrypt + INCLUDE_DIRS ${Bcrypt_INCLUDE_DIRS} + ) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Bcrypt + REQUIRED_VARS + Bcrypt_INCLUDE_DIRS + HANDLE_COMPONENTS +)