1 # Copyright 2012 OSMOCOM Project
3 # This file is part of rtl-sdr
5 # GNU Radio is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3, or (at your option)
10 # GNU Radio is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with GNU Radio; see the file COPYING. If not, write to
17 # the Free Software Foundation, Inc., 51 Franklin Street,
18 # Boston, MA 02110-1301, USA.
20 ########################################################################
22 ########################################################################
23 add_library(rtlsdr_shared SHARED
32 target_link_libraries(rtlsdr_shared
36 set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
37 set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
38 set_target_properties(rtlsdr_shared PROPERTIES SOVERSION 0 VERSION 0.0.0)
40 add_library(rtlsdr_static STATIC
50 add_library(libgetopt_static STATIC
55 target_link_libraries(rtlsdr_static
59 set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
62 # Force same library filename for static and shared variants of the library
63 set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
66 ########################################################################
68 ########################################################################
69 add_executable(rtl_sdr rtl_sdr.c)
70 add_executable(rtl_tcp rtl_tcp.c)
71 add_executable(rtl_test rtl_test.c)
72 add_executable(rtl_fm rtl_fm.c)
73 add_executable(rtl_eeprom rtl_eeprom.c)
74 add_executable(rtl_adsb rtl_adsb.c)
75 add_executable(rtl_433 rtl_433.c)
76 set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_433)
78 target_link_libraries(rtl_sdr rtlsdr_shared
80 ${CMAKE_THREAD_LIBS_INIT}
82 target_link_libraries(rtl_tcp rtlsdr_shared
84 ${CMAKE_THREAD_LIBS_INIT}
86 target_link_libraries(rtl_test rtlsdr_shared
88 ${CMAKE_THREAD_LIBS_INIT}
90 target_link_libraries(rtl_fm rtlsdr_shared
92 ${CMAKE_THREAD_LIBS_INIT}
94 target_link_libraries(rtl_433 rtlsdr_shared
96 ${CMAKE_THREAD_LIBS_INIT}
98 target_link_libraries(rtl_eeprom rtlsdr_shared
100 ${CMAKE_THREAD_LIBS_INIT}
102 target_link_libraries(rtl_adsb rtlsdr_shared
104 ${CMAKE_THREAD_LIBS_INIT}
107 target_link_libraries(rtl_fm m)
108 target_link_libraries(rtl_433 m)
109 target_link_libraries(rtl_adsb m)
111 target_link_libraries(rtl_test m)
113 target_link_libraries(rtl_test m rt)
118 target_link_libraries(rtl_sdr libgetopt_static)
119 target_link_libraries(rtl_tcp libgetopt_static)
120 target_link_libraries(rtl_test libgetopt_static)
121 target_link_libraries(rtl_fm libgetopt_static)
122 target_link_libraries(rtl_433 libgetopt_static)
123 target_link_libraries(rtl_eeprom libgetopt_static)
124 target_link_libraries(rtl_adsb libgetopt_static)
125 set_property(TARGET rtl_sdr APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
126 set_property(TARGET rtl_tcp APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
127 set_property(TARGET rtl_test APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
128 set_property(TARGET rtl_fm APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
129 set_property(TARGET rtl_433 APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
130 set_property(TARGET rtl_eeprom APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
131 set_property(TARGET rtl_adsb APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
133 ########################################################################
134 # Install built library files & utilities
135 ########################################################################
136 install(TARGETS ${INSTALL_TARGETS}
137 LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
138 ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
139 RUNTIME DESTINATION bin # .dll file