solve some problems on linker.

This commit is contained in:
eric 2020-06-26 22:13:27 +08:00
parent cf8e3cf696
commit d7fa7cde37
6 changed files with 12 additions and 7 deletions

View File

@ -11,6 +11,8 @@ find_package(OpenSSL 1.1.1 REQUIRED)
include_directories(${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${SQLiteCpp_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS} ${OPENSSL_INCLUDE_DIR} ${SQLiteCpp_INCLUDE_DIRS})
enable_testing()
add_subdirectory(src) add_subdirectory(src)
add_subdirectory(test) add_subdirectory(test)

View File

@ -27,7 +27,7 @@ namespace Net {
void printRed(string red_info); void printRed(string red_info);
void printInfo(const string& info, string tag = ""); void printInfo(const string& info, const string& tag = "");
void printInfoBuffer(const string& info, const string& tag = ""); void printInfoBuffer(const string& info, const string& tag = "");

View File

@ -24,9 +24,9 @@ namespace Net {
printf("\033[31m%s\n\033[0m", red_info.data()); printf("\033[31m%s\n\033[0m", red_info.data());
} }
void printInfo(const string& info, string &tag) { void printInfo(const string& info, const string& tag) {
printf("[DEBUG INFO] %s ", info.data()); printf("[DEBUG INFO] %s ", info.data());
if(tag.size()) if(!tag.empty())
printf("{ %s }\n",tag.data()); printf("{ %s }\n",tag.data());
} }

View File

@ -1 +1,3 @@
add_library(utils STATIC rsa_key_chain.cpp) add_library(utils STATIC rsa_key_chain.cpp)
target_link_libraries(utils debugTools ssl crypto)

View File

@ -1,9 +1,9 @@
add_executable(testUtils main.cpp) add_executable(testUtils main.cpp test_rsa.cpp)
message(${GTEST_LIBS}) message(${GTEST_LIBS})
link_libraries(testUtils utils debugTools ${GTEST_LIBS}) target_link_libraries(testUtils utils debugTools ${GTEST_LIBS})
add_test(Name testUtils add_test(Name testUtils
COMMAND testUtils) COMMAND testUtils)

View File

@ -21,7 +21,8 @@ TEST(RSATest, init_test_1) {
TEST(RSATest, generate_test_1) { TEST(RSATest, generate_test_1) {
env->rsa->generateKeyPair(); env->rsa->generateKeyPair();
printTools::printInfo(to_string(env->rsa->getBufferSize()), string("Buffer Size")); string data = std::to_string(env->rsa->getBufferSize());
printTools::printInfo(data, "Buffer Size");
} }
TEST(RSATest, pub_encrypt_test_1) { TEST(RSATest, pub_encrypt_test_1) {