From c7e9172c5e5fac12f5b3d884e1681410b3356717 Mon Sep 17 00:00:00 2001 From: ruanshudong Date: Tue, 5 Nov 2024 16:05:24 +0800 Subject: [PATCH] fix: force link mysql use static library --- CMakeLists.txt | 8 +++++++- mysql-tool/CMakeLists.txt | 6 +++++- tars-client/CMakeLists.txt | 6 +++++- tarscpp | 2 +- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d10c1d15..a5a2df8c 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,7 @@ macro(complice_module MODULE) add_dependencies(${MODULE} FRAMEWORK-PROTOCOL) add_dependencies(${MODULE} tars2cpp) - target_link_libraries(${MODULE} tarsservant tarsutil ${LIB_MYSQL}) + target_link_libraries(${MODULE} tarsservant tarsutil) if(TARS_SSL) target_link_libraries(${MODULE} ${LIB_SSL} ${LIB_CRYPTO}) @@ -80,6 +80,12 @@ macro(complice_module MODULE) target_link_libraries(${MODULE} ${LIB_HTTP2}) endif() + if(NOT WIN32) + target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/src/mysql/lib/libmysqlclient.a) + else () + target_link_libraries(${MODULE} ${LIB_MYSQL}) + endif() + if(NOT WIN32) link_libraries(pthread z dl) endif() diff --git a/mysql-tool/CMakeLists.txt b/mysql-tool/CMakeLists.txt index bf877ea2..247af5c7 100755 --- a/mysql-tool/CMakeLists.txt +++ b/mysql-tool/CMakeLists.txt @@ -21,6 +21,10 @@ if(TARS_HTTP2) target_link_libraries(${MODULE} ${LIB_HTTP2}) endif() -target_link_libraries(mysql-tool ${LIB_MYSQL}) +if(NOT WIN32) + target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/src/mysql/lib/libmysqlclient.a) +else () + target_link_libraries(${MODULE} ${LIB_MYSQL}) +endif() install(TARGETS mysql-tool DESTINATION deploy) \ No newline at end of file diff --git a/tars-client/CMakeLists.txt b/tars-client/CMakeLists.txt index 8ed9d30b..bc863f65 100644 --- a/tars-client/CMakeLists.txt +++ b/tars-client/CMakeLists.txt @@ -31,6 +31,10 @@ if(TARS_HTTP2) target_link_libraries(${MODULE} ${LIB_HTTP2}) endif() -target_link_libraries(tars-client ${LIB_MYSQL}) +if(NOT WIN32) + target_link_libraries(${MODULE} ${CMAKE_BINARY_DIR}/src/mysql/lib/libmysqlclient.a) +else () + target_link_libraries(${MODULE} ${LIB_MYSQL}) +endif() install(TARGETS tars-client DESTINATION deploy) \ No newline at end of file diff --git a/tarscpp b/tarscpp index 4a8a27c8..26d99a8d 160000 --- a/tarscpp +++ b/tarscpp @@ -1 +1 @@ -Subproject commit 4a8a27c8f587efc5fb7afef43107c3a84fb3a378 +Subproject commit 26d99a8df6fbc6b53b35e4d8800e064bdfc4deff