1From 608d0f1caf43628c8260a994c277a040f1e616e0 Mon Sep 17 00:00:00 2001
2From: Peter Bergin <peter.bergin@windriver.com>
3Date: Tue, 23 May 2023 13:19:55 +0200
4Subject: [PATCH] CMakeLists.txt: fix substitution for static libs
5
6During configuration the liibrary names are substitued for
7the static build. When building with tls support the first
8substitution will match both cases and trash the name for hiredis_ssl.
9
10Input string: 'hiredis::hiredis;hiredis::hiredis_ssl;'
11Output string: 'hiredis::hiredis_static;hiredis::hiredis_static_ssl;'
12Wanted string: 'hiredis::hiredis_static;hiredis::hiredis_ssl_static;'
13
14Fix string replacement by also including the ';' token to better match.
15
16Upstream-Status: Submitted [https://github.com/sewenew/redis-plus-plus/issues/486]
17
18Signed-off-by: Peter Bergin <peter.bergin@windriver.com>
19---
20 CMakeLists.txt | 5 ++---
21 1 file changed, 2 insertions(+), 3 deletions(-)
22
23diff --git a/CMakeLists.txt b/CMakeLists.txt
24index 69794d9..08c265d 100644
25--- a/CMakeLists.txt
26+++ b/CMakeLists.txt
27@@ -160,13 +160,12 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC)
28     set(REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC ${REDIS_PLUS_PLUS_HIREDIS_LIBS})
29
30     if (TARGET hiredis::hiredis_static)
31-      string(REPLACE "hiredis::hiredis" "hiredis::hiredis_static" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
32+      string(REPLACE "hiredis::hiredis;" "hiredis::hiredis_static;" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
33         "${REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC}")
34     endif()
35-
36     if (TARGET hiredis::hiredis_ssl_static)
37       # If SSL is not enabled, this line will have no effect
38-      string(REPLACE "hiredis::hiredis_ssl" "hiredis::hiredis_ssl_static" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
39+      string(REPLACE "hiredis::hiredis_ssl;" "hiredis::hiredis_ssl_static;" REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC
40         "${REDIS_PLUS_PLUS_HIREDIS_LIBS_STATIC}")
41     endif()
42
43--
442.34.1
45
46