1From 24ad50286a87833329213dc0b0e68c21aeeee95f Mon Sep 17 00:00:00 2001
2From: Niko Mauno <niko.mauno@vaisala.com>
3Date: Wed, 22 Apr 2020 09:00:00 +0300
4Subject: [PATCH] CMakeLists.txt: Avoid host-specific path to libsodium
5
6Avoid propagating full build host specific path to generated
7ZeroMQTargets.cmake when building with libsodium, which changes the
8content in generated ZeroMQTargets.cmake files followingly:
9
10  -INTERFACE_LINK_LIBRARIES "-lpthread;/build/host/specific/path/to/zeromq/4.3.2-r0/recipe-sysroot/usr/lib/libsodium.so;-lrt"
11  +INTERFACE_LINK_LIBRARIES "-lpthread;-lsodium;-lrt"
12
13This change mitigates an issue stemming from reuse of build artifacts
14where the path to libsodium.so does not match exactly between two
15different build hosts.
16
17Upstream-Status: Pending
18
19Signed-off-by: Niko Mauno <niko.mauno@vaisala.com>
20
21---
22 CMakeLists.txt | 4 ++--
23 1 file changed, 2 insertions(+), 2 deletions(-)
24
25diff --git a/CMakeLists.txt b/CMakeLists.txt
26index e92141d..d0775c1 100644
27--- a/CMakeLists.txt
28+++ b/CMakeLists.txt
29@@ -1428,7 +1428,7 @@ if(BUILD_SHARED)
30   endif()
31
32   if(SODIUM_FOUND)
33-    target_link_libraries(libzmq ${SODIUM_LIBRARIES})
34+    target_link_libraries(libzmq -lsodium)
35     # On Solaris, libsodium depends on libssp
36     if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
37       target_link_libraries(libzmq ssp)
38@@ -1473,7 +1473,7 @@ if(BUILD_STATIC)
39   endif()
40
41   if(SODIUM_FOUND)
42-    target_link_libraries(libzmq-static ${SODIUM_LIBRARIES})
43+    target_link_libraries(libzmq-static -lsodium)
44     # On Solaris, libsodium depends on libssp
45     if(${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
46       target_link_libraries(libzmq-static ssp)
47