aboutsummaryrefslogtreecommitdiffstats
path: root/src/CMakeLists.txt
diff options
context:
space:
mode:
authorDimitri Stolnikov <horiz0n@gmx.net>2014-08-26 21:26:26 +0200
committerDimitri Stolnikov <horiz0n@gmx.net>2014-08-26 21:26:26 +0200
commitd447a2e9830463ff83f6dcaef59b5684ff1df255 (patch)
tree893aaaf4b80d996228042d0448a30e063d5acde8 /src/CMakeLists.txt
parent6ee557360645da158e3065111349c318894b497b (diff)
cmake: include resource file for MSVC builds
Diffstat (limited to 'src/CMakeLists.txt')
-rw-r--r--src/CMakeLists.txt62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 77e1dc4..07d64ab 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -17,10 +17,11 @@
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.
-########################################################################
-# Setup library
-########################################################################
-add_library(rtlsdr_shared SHARED
+MACRO(RTLSDR_APPEND_SRCS)
+ LIST(APPEND rtlsdr_srcs ${ARGV})
+ENDMACRO(RTLSDR_APPEND_SRCS)
+
+RTLSDR_APPEND_SRCS(
librtlsdr.c
tuner_e4k.c
tuner_fc0012.c
@@ -29,24 +30,44 @@ add_library(rtlsdr_shared SHARED
tuner_r82xx.c
)
-target_link_libraries(rtlsdr_shared
- ${LIBUSB_LIBRARIES}
-)
+########################################################################
+# Set up Windows DLL resource files
+########################################################################
+IF(MSVC)
+ include(${CMAKE_SOURCE_DIR}/cmake/Modules/Version.cmake)
+
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
+ ${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc
+ @ONLY)
+ RTLSDR_APPEND_SRCS(${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
+ENDIF(MSVC)
+
+########################################################################
+# Setup shared library variant
+########################################################################
+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})
-add_library(rtlsdr_static STATIC
- librtlsdr.c
- tuner_e4k.c
- tuner_fc0012.c
- tuner_fc0013.c
- tuner_fc2580.c
- tuner_r82xx.c
-)
+########################################################################
+# Setup static library variant
+########################################################################
+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" )
+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()
+########################################################################
+# Setup libraries used in executables
+########################################################################
add_library(convenience_static STATIC
convenience/convenience.c
)
@@ -60,17 +81,6 @@ target_link_libraries(convenience_static
)
endif()
-target_link_libraries(rtlsdr_static
- ${LIBUSB_LIBRARIES}
-)
-
-set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
-
-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()
-
########################################################################
# Build utility
########################################################################