From a0fea7550dabcf04d3201f868657d836a0bb5f69 Mon Sep 17 00:00:00 2001 From: Alexander Fasching Date: Mon, 7 Oct 2019 01:05:15 +0200 Subject: [PATCH] Build with cmake for both versions Signed-off-by: Gwenhael Goavec-Merou --- CMakeLists.txt | 12 ++++++++---- src/CMakeLists.txt | 9 +++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c197f152..4bff6f08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,15 +99,20 @@ endfunction(add_source_files) # 3rd Party Dependency Stuff find_package(Qt5 COMPONENTS Core Network Widgets Svg REQUIRED) -find_package(Boost COMPONENTS system program_options REQUIRED) -set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG AUDIO BLOCKS DIGITAL FILTER FFT PMT) -find_package(Gnuradio REQUIRED) find_package(Gnuradio-osmosdr REQUIRED) -if(NOT GNURADIO_RUNTIME_FOUND) +set(GR_REQUIRED_COMPONENTS RUNTIME ANALOG AUDIO BLOCKS DIGITAL FILTER FFT PMT) +find_package(Gnuradio REQUIRED COMPONENTS analog audio blocks digital filter fft) + +if(NOT Gnuradio_FOUND) message(FATAL_ERROR "GnuRadio Runtime required to compile gqrx") endif() +if(Gnuradio_VERSION VERSION_LESS "3.8") + add_definitions(-DGNURADIO_37) + find_package(Boost COMPONENTS system program_options REQUIRED) +endif() + if(${CMAKE_SYSTEM_NAME} MATCHES "Linux") if(NOT LINUX_AUDIO_BACKEND) set(LINUX_AUDIO_BACKEND Pulseaudio CACHE STRING "Choose the audio backend, options are: Pulseaudio, Portaudio, Gr-audio" FORCE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2598f223..88c54046 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,6 +70,15 @@ target_link_libraries(${PROJECT_NAME} ${PORTAUDIO_LIBRARIES} ) +if(NOT Gnuradio_VERSION VERSION_LESS "3.8") + target_link_libraries(${PROJECT_NAME} + gnuradio::gnuradio-analog + gnuradio::gnuradio-blocks + gnuradio::gnuradio-digital + gnuradio::gnuradio-filter + ) +endif() + #build a win32 app, not a console app if (WIN32) set(CMAKE_EXE_LINKER_FLAGS "/entry:mainCRTStartup ${CMAKE_EXE_LINKER_FLAGS}")