python-dataproperty: bump version to 0.17.0
[buildroot-gz.git] / package / yajl / 0004-Link-libyajl-_s-with-libm-when-isnan-is-not-brought-.patch
blob71cf2958ee4fa7e7763d55ae6234a932f8e81067
1 From b47f6a50925efb8c8707b1faed5561a4b66ffdb1 Mon Sep 17 00:00:00 2001
2 From: Samuel Martin <s.martin49@gmail.com>
3 Date: Sun, 24 Apr 2016 18:45:27 +0200
4 Subject: [PATCH] Link libyajl{,_s} with libm when isnan is not brought by the
5 libc
7 Check whether isnan is provided by the libc library, otherwise make sure
8 yajl libraries are link against libm.
10 Note that setting libm as PUBLIC link libraries enable the transitivity
11 [1, 2]; therefore it will be automatically passed to target linking
12 against libyajl{,_s}.
14 This patch also makes sure the link libraries will appear in the yajl.pc
15 file.
17 [1] https://cmake.org/cmake/help/v3.5/command/target_link_libraries.html
18 [2] https://cmake.org/cmake/help/v3.5/manual/cmake-buildsystem.7.html#target-usage-requirements
20 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
21 ---
22 src/CMakeLists.txt | 10 ++++++++++
23 src/yajl.pc.cmake | 2 +-
24 2 files changed, 11 insertions(+), 1 deletion(-)
26 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
27 index b487bfd..a88698f 100644
28 --- a/src/CMakeLists.txt
29 +++ b/src/CMakeLists.txt
30 @@ -35,11 +35,21 @@ SET (shareDir ${CMAKE_CURRENT_BINARY_DIR}/../${YAJL_DIST_NAME}/share/pkgconfig)
31 # set the output path for libraries
32 SET(LIBRARY_OUTPUT_PATH ${libDir})
34 +SET(yajl_lib_link)
35 +INCLUDE(CheckLibraryExists)
36 +CHECK_LIBRARY_EXISTS(c isnan "" HAVE_LIBC_ISNAN)
38 +IF(NOT HAVE_LIBC_ISNAN)
39 + LIST(APPEND yajl_lib_link "-lm")
40 +ENDIF(NOT HAVE_LIBC_ISNAN)
42 ADD_LIBRARY(yajl_s STATIC ${SRCS} ${HDRS} ${PUB_HDRS})
43 SET_TARGET_PROPERTIES(yajl_s PROPERTIES OUTPUT_NAME yajl)
44 +TARGET_LINK_LIBRARIES(yajl_s PUBLIC ${yajl_lib_link})
46 IF(BUILD_SHARED_LIBS)
47 ADD_LIBRARY(yajl SHARED ${SRCS} ${HDRS} ${PUB_HDRS})
48 +TARGET_LINK_LIBRARIES(yajl PUBLIC ${yajl_lib_link})
50 #### setup shared library version number
51 SET_TARGET_PROPERTIES(yajl PROPERTIES
52 diff --git a/src/yajl.pc.cmake b/src/yajl.pc.cmake
53 index 6eaca14..4681dd4 100644
54 --- a/src/yajl.pc.cmake
55 +++ b/src/yajl.pc.cmake
56 @@ -6,4 +6,4 @@ Name: Yet Another JSON Library
57 Description: A Portable JSON parsing and serialization library in ANSI C
58 Version: ${YAJL_MAJOR}.${YAJL_MINOR}.${YAJL_MICRO}
59 Cflags: -I${dollar}{includedir}
60 -Libs: -L${dollar}{libdir} -lyajl
61 +Libs: -L${dollar}{libdir} -lyajl ${yajl_lib_link}
62 --
63 2.8.0