From 1aac48068eca9316ec259af27e8a63260f24d473 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Tue, 17 Aug 2021 22:35:09 +0200 Subject: [PATCH] Reduce the repeated library dependence information Cmake is generally good at tracking specified dependencies between libraries. All that we need to do is to establish a dependency on OpenSSL's libcrypto for 'gost_core', and then we can reduce the amount of repeated dependencies for everything that links against 'gost_core'. (cherry picked from commit 7ca9b827135b90cfc2567058b56325a518a3d57a) # Conflicts: # CMakeLists.txt --- CMakeLists.txt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d0b489..21f5b19 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -188,7 +188,7 @@ add_test(NAME digest COMMAND test_digest) add_executable(test_curves test_curves.c) -target_link_libraries(test_curves gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(test_curves gost_engine gost_core) add_test(NAME curves COMMAND test_curves) @@ -208,7 +208,7 @@ add_test(NAME TLS COMMAND test_tls) add_executable(test_context test_context.c) -target_link_libraries(test_context ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(test_context gost_engine gost_core ${OPENSSL_CRYPTO_LIBRARIES}) add_test(NAME context COMMAND test_context) @@ -219,12 +219,12 @@ add_test(NAME grasshopper add_executable(test_keyexpimp test_keyexpimp.c) #target_compile_definitions(test_keyexpimp PUBLIC -DOPENSSL_LOAD_CONF) -target_link_libraries(test_keyexpimp gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(test_keyexpimp gost_engine gost_core) add_test(NAME keyexpimp COMMAND test_keyexpimp) add_executable(test_gost89 test_gost89.c) -target_link_libraries(test_gost89 gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(test_gost89 gost_core) add_test(NAME gost89 COMMAND test_gost89) @@ -243,7 +243,7 @@ if(NOT SKIP_PERL_TESTS) endif() add_executable(sign benchmark/sign.c) -target_link_libraries(sign gost_core ${OPENSSL_CRYPTO_LIBRARIES} ${CLOCK_GETTIME_LIB}) +target_link_libraries(sign gost_core ${CLOCK_GETTIME_LIB}) # All that may need to load just built engine will have path to it defined. set(BINARY_TESTS_TARGETS @@ -261,15 +261,16 @@ set_property(TARGET ${BINARY_TESTS_TARGETS} APPEND PROPERTY COMPILE_DEFINITIONS add_library(gost_core STATIC ${GOST_LIB_SOURCE_FILES}) set_target_properties(gost_core PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_link_libraries(gost_core PRIVATE ${OPENSSL_CRYPTO_LIBRARIES}) add_library(gost_engine SHARED ${GOST_ENGINE_SOURCE_FILES}) set_target_properties(gost_engine PROPERTIES PREFIX "" OUTPUT_NAME "gost") set_target_properties(gost_engine PROPERTIES VERSION ${GOST_SOVERSION} SOVERSION ${GOST_SOVERSION}) -target_link_libraries(gost_engine PRIVATE gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(gost_engine PRIVATE gost_core) add_library(gost_engine_static STATIC ${GOST_ENGINE_SOURCE_FILES}) set_target_properties(gost_engine_static PROPERTIES PREFIX "lib" PUBLIC_HEADER gost-engine.h OUTPUT_NAME "gost") -target_link_libraries(gost_engine_static PRIVATE gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(gost_engine_static PRIVATE gost_core) set(GOST_SUM_SOURCE_FILES @@ -277,7 +278,7 @@ set(GOST_SUM_SOURCE_FILES ) add_executable(gostsum ${GOST_SUM_SOURCE_FILES}) -target_link_libraries(gostsum gost_core ${OPENSSL_CRYPTO_LIBRARIES}) +target_link_libraries(gostsum gost_core) set(GOST_12_SUM_SOURCE_FILES gost12sum.c -- 2.39.2