forked from hayguen/ExtIO_RTL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
69 lines (54 loc) · 1.99 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.7.2)
if(${CMAKE_VERSION} VERSION_LESS "3.12.0")
project(ExtIO_RTL)
else()
project(ExtIO_RTL CXX)
endif()
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
find_package(Threads)
find_package(PkgConfig)
find_package(RTLSDR)
if (NOT RTLSDR_FOUND)
message(STATUS "RTL-SDR development files not found...")
set(RTLSDR_LIBRARIES "" CACHE STRING "manual RTL-SDR library path")
set(RTLSDR_INCLUDE_DIRS "" CACHE STRING "manual RTL-SDR include path")
endif ()
message(STATUS "RTLSDR_INCLUDE_DIRS - ${RTLSDR_INCLUDE_DIRS}")
message(STATUS "RTLSDR_LIBRARIES - ${RTLSDR_LIBRARIES}")
if(PKG_CONFIG_FOUND)
pkg_check_modules(LIBUSB libusb-1.0 IMPORTED_TARGET)
else()
set(LIBUSB_LIBRARIES "" CACHE STRING "manual libusb path")
set(LIBUSB_INCLUDE_DIRS "" CACHE STRING "manual libusb include path")
endif()
if(MSVC)
set(THREADS_PTHREADS_LIBRARY "" CACHE STRING "manual pthread-win32 path")
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE STRING "manual pthread-win32 includepath")
else()
set(THREADS_PTHREADS_LIBRARY "" CACHE INTERNAL "manual pthread-win32 path")
set(THREADS_PTHREADS_INCLUDE_DIR "" CACHE INTERNAL "manual pthread-win32 includepath")
endif()
if(PKG_CONFIG_FOUND AND NOT LIBUSB_FOUND)
message(FATAL_ERROR "LibUSB 1.0 required to compile ExtIO_RTL")
endif()
if(NOT THREADS_FOUND)
message(FATAL_ERROR "pthreads(-win32) required to compile ExtIO_RTL")
endif()
include_directories(${RTLSDR_INCLUDE_DIRS})
include_directories(ExtIO_RTL PRIVATE
${CMAKE_SOURCE_DIR}/res
)
add_library(ExtIO_RTL SHARED
src/ExtIO_RTL.cpp src/ExtIO_RTL.h src/ExtIO_RTL.def src/dllmain.cpp
res/resource.h res/resource.rc
)
set_property(TARGET ExtIO_RTL PROPERTY CXX_STANDARD 17)
set_property(TARGET ExtIO_RTL PROPERTY CXX_STANDARD_REQUIRED ON)
target_compile_definitions(ExtIO_RTL PUBLIC _CRT_SECURE_NO_WARNINGS)
target_link_libraries(ExtIO_RTL PRIVATE
${LIBUSB_LIBRARIES}
${RTLSDR_LIBRARIES}
${THREADS_PTHREADS_LIBRARY}
)