-
Notifications
You must be signed in to change notification settings - Fork 70
/
CMakeLists.txt
75 lines (60 loc) · 1.87 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
70
71
72
73
74
75
cmake_minimum_required(VERSION 3.5)
project(auto_sdr LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Add the local Find*.cmake scripts
LIST(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wpedantic -Wno-missing-braces")
find_package(spdlog REQUIRED)
find_package(RTLSDR REQUIRED)
find_package(Threads REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(GTest REQUIRED)
find_package(Boost REQUIRED)
find_library(FFTW_LIB fftw3)
if(NOT FFTW_LIB)
message(FATAL_ERROR "fftw3 library not found")
endif()
find_library(LIQUID_LIB liquid)
if(NOT LIQUID_LIB)
message(FATAL_ERROR "liquid library not found")
endif()
find_library(MOSQUITTO_LIB mosquitto)
if(NOT MOSQUITTO_LIB)
message(FATAL_ERROR "mosquitto library not found")
endif()
find_library(HACKRF_LIB hackrf)
if(NOT HACKRF_LIB)
message(FATAL_ERROR "hackrf library not found")
endif()
file(GLOB_RECURSE SOURCES
"${PROJECT_SOURCE_DIR}/sources/*.h"
"${PROJECT_SOURCE_DIR}/sources/*.cpp"
)
file(GLOB_RECURSE TEST_SOURCES
"${PROJECT_SOURCE_DIR}/tests/*.cpp"
)
list(REMOVE_ITEM SOURCES "${PROJECT_SOURCE_DIR}/sources/main.cpp")
list(REMOVE_ITEM TEST_SOURCES "${PROJECT_SOURCE_DIR}/tests/test_main.cpp")
include_directories("${CMAKE_SOURCE_DIR}/sources")
add_library(auto_sdr_libs STATIC ${SOURCES})
TARGET_LINK_LIBRARIES(auto_sdr_libs
spdlog::spdlog
rtlsdr
Threads::Threads
fftw3_threads
fftw3
fftw3f_threads
fftw3f
liquid
mosquitto
hackrf
stdc++fs
nlohmann_json::nlohmann_json
)
add_executable(auto_sdr "sources/main.cpp")
target_link_libraries(auto_sdr auto_sdr_libs)
add_executable(auto_sdr_test ${TEST_SOURCES} "tests/test_main.cpp")
target_link_libraries(auto_sdr_test auto_sdr_libs gtest)
install(TARGETS auto_sdr DESTINATION)
install(TARGETS auto_sdr_test DESTINATION)