Fix linking issues

FossilOrigin-Name: 0c67e514a79150a1db7d0c0772359fc5987f2d3f8730d96c916ee2b78721bd3b
This commit is contained in:
nekobit 2022-10-14 12:27:28 +00:00
parent 181669cd73
commit a9fdab5469
3 changed files with 10 additions and 8 deletions

View file

@ -18,6 +18,7 @@ add_library(wormhole_lib
src/http/response.cpp
src/http/mime.cpp
src/http/error_response.cpp
src/crypt/rsa.cpp
src/config/config_http.cpp
src/config/config_db.cpp
src/config/config_loader.cpp
@ -40,7 +41,7 @@ find_package(RapidJSON)
find_package(PkgConfig REQUIRED)
find_package(Threads REQUIRED)
find_package(SQLite3)
find_package(OpenSSL)
find_package(OpenSSL REQUIRED)
pkg_check_modules(LIBMICROHTTPD REQUIRED libmicrohttpd)
pkg_check_modules(YAML_CPP REQUIRED yaml-cpp)
@ -82,7 +83,8 @@ set(WORMHOLE_INCLUDE_DIRS
${LIBMICROHTTPD_INCLUDE_DIRS}
${YAML_CPP_INCLUDE_DIRS}
${SQLite3_INCLUDE_DIRS}
${RapidJSON_INCLUDE_DIRS}
${OPENSSL_INCLUDE_DIR}
${RAPIDJSON_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/src/
CACHE INTERNAL "")
@ -100,7 +102,7 @@ target_link_libraries(wormhole wormhole_lib
wormhole_host_meta_module
${CMAKE_DL_LIBS}
${LIBMICROHTTPD_LIBRARIES}
${YAML_CPP_LIBRARIES}
${SQLite3_LIBRARIES}
${RapidJSON_LIBRARIES}
${YAML_CPP_LIBRARIES}
${OPENSSL_CRYPTO_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})

View file

@ -35,12 +35,12 @@ Rsa::Rsa(std::shared_ptr<::RSA> key)
{}
RsaFactory::RsaFactory()
: e(BN_new(), DeleterBN{}),
: e(BN_new(), DeleterBN{})
{
std::srand(std::time(nullptr));
}
RSA RsaFactory::generate_key(const size_t bits /* = 2<<10 */)
Rsa RsaFactory::generate_key(const size_t bits /* = 2<<10 */)
{
int code;
RSA* rsa = RSA_new();
@ -48,5 +48,5 @@ RSA RsaFactory::generate_key(const size_t bits /* = 2<<10 */)
if (!code)
throw std::runtime_error(ERR_reason_error_string(ERR_get_error()));
return { std::shared_ptr<::RSA>{rsa, DeleterRSA{}} };
return Rsa{ std::shared_ptr<::RSA>{rsa, DeleterRSA{}} };
}

View file

@ -4,5 +4,5 @@ target_link_libraries(request_test wormhole_lib)
add_test(NAME request_test COMMAND $<TARGET_FILE:request_test>)
add_executable(rsa_test rsa_gen_test.cpp)
target_link_libraries(rsa_test wormhole_lib)
target_link_libraries(rsa_test wormhole_lib ${OPENSSL_CRYPTO_LIBRARIES})
add_test(NAME rsa_test COMMAND $<TARGET_FILE:rsa_test>)