sngrep: fix error if gnutls and openssl are both enabled
[buildroot-gz.git] / package / yajl / 0003-Link-with-shared-libyajl-in-a-shared-build.patch
blobd3c91f2b9e53f7db89abe0672ce1a74790a2cd02
1 From 425b25993ef58d07aa18c5d4938876a90e22c47a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
3 Date: Sat, 9 Apr 2016 23:24:27 +0200
4 Subject: [PATCH] Link with shared libyajl in a shared build
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 Building yajl in a static context fails in a parallel build:
11 [ 21%] Linking C executable gen-extra-close
12 [ 26%] Building C object src/CMakeFiles/yajl_s.dir/yajl_buf.c.o
13 /home/test/autobuild/instance-3/output/host/opt/ext-toolchain/bfin-uclinux/bfin-uclinux/bin/ld.real: cannot find -lyajl
15 Fix this issue by linking against the shared libyail in a shared build. Apply
16 this fix also to all other build targets who are linking against the library.
18 Upstream status: Pending
19 https://github.com/lloyd/yajl/pull/187
21 [Update: align with commit 302563539dacb284576a443401cdfd061eb2e1e8 and remove
22 linking with libm from test/api/CMakeLists.txt]
23 Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
24 ---
25 example/CMakeLists.txt | 7 ++++++-
26 perf/CMakeLists.txt | 6 +++++-
27 reformatter/CMakeLists.txt | 6 +++++-
28 test/api/CMakeLists.txt | 6 +++++-
29 test/parsing/CMakeLists.txt | 6 +++++-
30 verify/CMakeLists.txt | 6 +++++-
31 6 files changed, 31 insertions(+), 6 deletions(-)
33 diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
34 index 0a7f622..8cfcef8 100644
35 --- a/example/CMakeLists.txt
36 +++ b/example/CMakeLists.txt
37 @@ -20,4 +20,9 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
39 ADD_EXECUTABLE(parse_config ${SRCS})
41 -TARGET_LINK_LIBRARIES(parse_config yajl_s)
42 +IF(BUILD_SHARED_LIBS)
43 + TARGET_LINK_LIBRARIES(parse_config yajl)
44 +ELSE()
45 + TARGET_LINK_LIBRARIES(parse_config yajl_s)
46 +ENDIF()
48 diff --git a/perf/CMakeLists.txt b/perf/CMakeLists.txt
49 index b438d7a..40ba363 100644
50 --- a/perf/CMakeLists.txt
51 +++ b/perf/CMakeLists.txt
52 @@ -20,4 +20,8 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
54 ADD_EXECUTABLE(perftest ${SRCS})
56 -TARGET_LINK_LIBRARIES(perftest yajl_s)
57 +IF(BUILD_SHARED_LIBS)
58 + TARGET_LINK_LIBRARIES(perftest yajl)
59 +ELSE()
60 + TARGET_LINK_LIBRARIES(perftest yajl_s)
61 +ENDIF()
62 diff --git a/reformatter/CMakeLists.txt b/reformatter/CMakeLists.txt
63 index 52a9bee..7629094 100644
64 --- a/reformatter/CMakeLists.txt
65 +++ b/reformatter/CMakeLists.txt
66 @@ -26,7 +26,11 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
68 ADD_EXECUTABLE(json_reformat ${SRCS})
70 -TARGET_LINK_LIBRARIES(json_reformat yajl_s)
71 +IF(BUILD_SHARED_LIBS)
72 + TARGET_LINK_LIBRARIES(json_reformat yajl)
73 +ELSE()
74 + TARGET_LINK_LIBRARIES(json_reformat yajl_s)
75 +ENDIF()
77 # In some environments, we must explicitly link libm (like qnx,
78 # thanks @shahbag)
79 diff --git a/test/api/CMakeLists.txt b/test/api/CMakeLists.txt
80 index cd65a54..0c9debf 100644
81 --- a/test/api/CMakeLists.txt
82 +++ b/test/api/CMakeLists.txt
83 @@ -21,5 +21,9 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../../${YAJL_DIST_NAME}/lib)
84 FOREACH (test ${TESTS})
85 GET_FILENAME_COMPONENT(testProg ${test} NAME_WE)
86 ADD_EXECUTABLE(${testProg} ${test})
87 - TARGET_LINK_LIBRARIES(${testProg} yajl)
88 + IF(BUILD_SHARED_LIBS)
89 + TARGET_LINK_LIBRARIES(${testProg} yajl)
90 + ELSE()
91 + TARGET_LINK_LIBRARIES(${testProg} yajl_s)
92 + ENDIF()
93 ENDFOREACH()
94 diff --git a/test/parsing/CMakeLists.txt b/test/parsing/CMakeLists.txt
95 index c22a388..285f048 100644
96 --- a/test/parsing/CMakeLists.txt
97 +++ b/test/parsing/CMakeLists.txt
98 @@ -20,4 +20,8 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../../${YAJL_DIST_NAME}/lib)
100 ADD_EXECUTABLE(yajl_test ${SRCS})
102 -TARGET_LINK_LIBRARIES(yajl_test yajl_s)
103 +IF(BUILD_SHARED_LIBS)
104 + TARGET_LINK_LIBRARIES(yajl_test yajl)
105 +ELSE()
106 + TARGET_LINK_LIBRARIES(yajl_test yajl_s)
107 +ENDIF()
108 diff --git a/verify/CMakeLists.txt b/verify/CMakeLists.txt
109 index 967fca1..06cb2dc 100644
110 --- a/verify/CMakeLists.txt
111 +++ b/verify/CMakeLists.txt
112 @@ -26,7 +26,11 @@ LINK_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/lib)
114 ADD_EXECUTABLE(json_verify ${SRCS})
116 -TARGET_LINK_LIBRARIES(json_verify yajl_s)
117 +IF(BUILD_SHARED_LIBS)
118 + TARGET_LINK_LIBRARIES(json_verify yajl)
119 +ELSE()
120 + TARGET_LINK_LIBRARIES(json_verify yajl_s)
121 +ENDIF()
123 # copy in the binary
124 GET_TARGET_PROPERTY(binPath json_verify LOCATION)
126 2.8.0