summaryrefslogtreecommitdiffstats
path: root/package/librtlsdr/0001-disable_shared_library_target_in_build.patch
blob: b9f53d23933010e345534751391608d56cc40534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From d47e3aed12414be59bf77177c93853ec4b24d705 Mon Sep 17 00:00:00 2001
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Date: Sat, 2 Jun 2018 16:53:36 +0200
Subject: [PATCH] disable shared library target in build

Disable shared library target if BUILD_SHARED_LIBS if OFF.

Patch retrieved from
https://git.buildroot.net/buildroot/tree/package/librtlsdr/0001-disable_shared_library_target_in_build.patch?h=2018.05

Patch has been updated to work with 0.5.4 and to be able to keep current
behavior of building shared and static version of library if
BUILD_SHARED_LIBS and BUILD_STATIC_LIBS are both set.
Moreover, if BUILD_STATIC_LIBS is OFF, only shared version of library
will be install.

[Upstream status: https://github.com/steve-m/librtlsdr/pull/46]

Signed-off-by: Yuvaraj Patil <yuvaraj.patil@wipro.com>
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
---
 src/CMakeLists.txt | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 07d64ab..2b7cbae 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -47,16 +47,22 @@ ENDIF(MSVC)
 ########################################################################
 # Setup shared library variant
 ########################################################################
+option(BUILD_SHARED_LIBS "Build shared library" ON)
+if(BUILD_SHARED_LIBS)
 add_library(rtlsdr_shared SHARED ${rtlsdr_srcs})
 target_link_libraries(rtlsdr_shared ${LIBUSB_LIBRARIES})
 set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
 set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
 set_target_properties(rtlsdr_shared PROPERTIES SOVERSION ${MAJOR_VERSION})
 set_target_properties(rtlsdr_shared PROPERTIES VERSION ${LIBVER})
+list(APPEND rtlsdr_lib rtlsdr_shared)
+endif()
 
 ########################################################################
 # Setup static library variant
 ########################################################################
+option(BUILD_STATIC_LIBS "Build static library" ON)
+if(BUILD_STATIC_LIBS)
 add_library(rtlsdr_static STATIC ${rtlsdr_srcs})
 target_link_libraries(rtlsdr_static ${LIBUSB_LIBRARIES})
 set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
@@ -64,6 +70,8 @@ if(NOT WIN32)
 # Force same library filename for static and shared variants of the library
 set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
 endif()
+list(APPEND rtlsdr_lib rtlsdr_static)
+endif()
 
 ########################################################################
 # Setup libraries used in executables
@@ -91,33 +99,33 @@ add_executable(rtl_fm rtl_fm.c)
 add_executable(rtl_eeprom rtl_eeprom.c)
 add_executable(rtl_adsb rtl_adsb.c)
 add_executable(rtl_power rtl_power.c)
-set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power)
+set(INSTALL_TARGETS ${rtlsdr_lib} rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power)
 
-target_link_libraries(rtl_sdr rtlsdr_shared convenience_static
+target_link_libraries(rtl_sdr ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_tcp rtlsdr_shared convenience_static
+target_link_libraries(rtl_tcp ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_test rtlsdr_shared convenience_static
+target_link_libraries(rtl_test ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_fm rtlsdr_shared convenience_static
+target_link_libraries(rtl_fm ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_eeprom rtlsdr_shared convenience_static
+target_link_libraries(rtl_eeprom ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_adsb rtlsdr_shared convenience_static
+target_link_libraries(rtl_adsb ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-target_link_libraries(rtl_power rtlsdr_shared convenience_static
+target_link_libraries(rtl_power ${rtlsdr_lib} convenience_static
     ${LIBUSB_LIBRARIES}
     ${CMAKE_THREAD_LIBS_INIT}
 )
-- 
2.14.1

OpenPOWER on IntegriCloud