build: cmake: add Findcryptopp.cmake

seastar dropped the dependency to Crypto++, and it also removed
Findcryptopp.cmake from its `cmake` directory. but scylladb still
depends on this library. and it has been using the `Findcryptopp.cmake`
in seastar submodule for finding it.

after the removal of this file, scylladb would not be able to
use it anymore. so, we have to provide our own `Findcryptopp.cmake`.

Findcryptopp.cmake is copied from the Seastar project. So its
date of copyright is preserved. and it was licensed under Apache 2.0,
since we are creating a derivative work from it. let's relicense
it under Apache 2.0 and AGPL 3.0 or later.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>

Closes scylladb/scylladb#16601
This commit is contained in:
Kefu Chai
2024-01-02 17:29:39 +08:00
committed by Avi Kivity
parent 34259a03d0
commit 2508d33946

37
cmake/Findcryptopp.cmake Normal file
View File

@@ -0,0 +1,37 @@
/*
* Copyright (C) 2018-present ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
find_library (cryptopp_LIBRARY
NAMES cryptopp)
find_path (cryptopp_INCLUDE_DIR
NAMES cryptopp/aes.h
PATH_SUFFIXES cryptopp)
mark_as_advanced (
cryptopp_LIBRARY
cryptopp_INCLUDE_DIR)
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (cryptopp
REQUIRED_VARS
cryptopp_LIBRARY
cryptopp_INCLUDE_DIR)
set (cryptopp_LIBRARIES ${cryptopp_LIBRARY})
set (cryptopp_INCLUDE_DIRS ${cryptopp_INCLUDE_DIR})
if (cryptopp_FOUND AND NOT (TARGET cryptopp::cryptopp))
add_library (cryptopp::cryptopp UNKNOWN IMPORTED)
set_target_properties (cryptopp::cryptopp
PROPERTIES
IMPORTED_LOCATION ${cryptopp_LIBRARIES}
INTERFACE_INCLUDE_DIRECTORIES ${cryptopp_INCLUDE_DIRS})
endif ()