17
17
# the Free Software Foundation, Inc., 51 Franklin Street,
18
18
# Boston, MA 02110-1301, USA.
19
19
20
- ########################################################################
21
- # Setup library
22
- ########################################################################
23
- add_library (rtlsdr_shared SHARED
20
+ MACRO (RTLSDR_APPEND_SRCS)
21
+ LIST (APPEND rtlsdr_srcs ${ARGV} )
22
+ ENDMACRO (RTLSDR_APPEND_SRCS)
23
+
24
+ RTLSDR_APPEND_SRCS(
24
25
librtlsdr.c
25
26
tuner_e4k.c
26
27
tuner_fc0012.c
@@ -29,24 +30,44 @@ add_library(rtlsdr_shared SHARED
29
30
tuner_r82xx.c
30
31
)
31
32
32
- target_link_libraries (rtlsdr_shared
33
- ${LIBUSB_LIBRARIES}
34
- )
33
+ ########################################################################
34
+ # Set up Windows DLL resource files
35
+ ########################################################################
36
+ IF (MSVC )
37
+ include (${CMAKE_SOURCE_DIR} /cmake/Modules/Version .cmake)
38
+
39
+ configure_file (
40
+ ${CMAKE_CURRENT_SOURCE_DIR} /rtlsdr.rc.in
41
+ ${CMAKE_CURRENT_BINARY_DIR} /rtlsdr.rc
42
+ @ONLY)
35
43
44
+ RTLSDR_APPEND_SRCS(${CMAKE_CURRENT_BINARY_DIR} /rtlsdr.rc)
45
+ ENDIF (MSVC )
46
+
47
+ ########################################################################
48
+ # Setup shared library variant
49
+ ########################################################################
50
+ add_library (rtlsdr_shared SHARED ${rtlsdr_srcs} )
51
+ target_link_libraries (rtlsdr_shared ${LIBUSB_LIBRARIES} )
36
52
set_target_properties (rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS" )
37
53
set_target_properties (rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
38
54
set_target_properties (rtlsdr_shared PROPERTIES SOVERSION ${MAJOR_VERSION} )
39
55
set_target_properties (rtlsdr_shared PROPERTIES VERSION ${LIBVER} )
40
56
41
- add_library (rtlsdr_static STATIC
42
- librtlsdr.c
43
- tuner_e4k.c
44
- tuner_fc0012.c
45
- tuner_fc0013.c
46
- tuner_fc2580.c
47
- tuner_r82xx.c
48
- )
57
+ ########################################################################
58
+ # Setup static library variant
59
+ ########################################################################
60
+ add_library (rtlsdr_static STATIC ${rtlsdr_srcs} )
61
+ target_link_libraries (rtlsdr_static ${LIBUSB_LIBRARIES} )
62
+ set_property (TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
63
+ if (NOT WIN32 )
64
+ # Force same library filename for static and shared variants of the library
65
+ set_target_properties (rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
66
+ endif ()
49
67
68
+ ########################################################################
69
+ # Setup libraries used in executables
70
+ ########################################################################
50
71
add_library (convenience_static STATIC
51
72
convenience/convenience.c
52
73
)
@@ -60,17 +81,6 @@ target_link_libraries(convenience_static
60
81
)
61
82
endif ()
62
83
63
- target_link_libraries (rtlsdr_static
64
- ${LIBUSB_LIBRARIES}
65
- )
66
-
67
- set_property (TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
68
-
69
- if (NOT WIN32 )
70
- # Force same library filename for static and shared variants of the library
71
- set_target_properties (rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
72
- endif ()
73
-
74
84
########################################################################
75
85
# Build utility
76
86
########################################################################
0 commit comments