From da0fb2268bbc6d7a769afa3eef749b9e3e48de61 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Wed, 27 Apr 2022 21:45:25 -0400 Subject: [PATCH 1/2] Use include paths and libraries from pkg-config If the libraries discovered by pkg-config are installed in a nonstandard location, these are required to include their headers and link with their libraries. --- src/goesproc/CMakeLists.txt | 8 +++----- src/goesrecv/CMakeLists.txt | 6 ++++-- src/goesrecv/airspy_source.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/goesproc/CMakeLists.txt b/src/goesproc/CMakeLists.txt index 8778c547..4a6dca14 100644 --- a/src/goesproc/CMakeLists.txt +++ b/src/goesproc/CMakeLists.txt @@ -43,11 +43,8 @@ target_link_libraries(goesproc timer) target_link_libraries(goesproc version) if(OPENCV_FOUND) - target_link_libraries(goesproc opencv_core opencv_highgui opencv_imgproc) + target_link_libraries(goesproc ${OPENCV_LINK_LIBRARIES}) target_include_directories(goesproc PRIVATE ${OPENCV_INCLUDE_DIRS}) - if(${OPENCV_VERSION} VERSION_GREATER 3.0) - target_link_libraries(goesproc opencv_imgcodecs) - endif() endif() if(PROJ_FOUND) @@ -60,5 +57,6 @@ if(PROJ_FOUND) PROJ_VERSION_MINOR=${PROJ_VERSION_MINOR} PROJ_VERSION_PATCH=${PROJ_VERSION_PATCH}) target_compile_definitions(goesproc PRIVATE HAS_PROJ) - target_link_libraries(goesproc proj) + target_include_directories(goesproc PRIVATE ${PROJ_INCLUDE_DIRS}) + target_link_libraries(goesproc ${PROJ_LINK_LIBRARIES}) endif() diff --git a/src/goesrecv/CMakeLists.txt b/src/goesrecv/CMakeLists.txt index b8a0934e..85511b42 100644 --- a/src/goesrecv/CMakeLists.txt +++ b/src/goesrecv/CMakeLists.txt @@ -14,7 +14,8 @@ if(NOT AIRSPY_FOUND) message(WARNING "Unable to find libairspy") else() add_library(airspy_source airspy_source.cc) - target_link_libraries(airspy_source ${AIRSPY_LIBRARIES} publisher stdc++) + target_include_directories(airspy_source PUBLIC ${AIRSPY_INCLUDE_DIRS}) + target_link_libraries(airspy_source ${AIRSPY_LINK_LIBRARIES} publisher stdc++) endif() pkg_check_modules(RTLSDR librtlsdr) @@ -26,7 +27,8 @@ else() (RTLSDR_VERSION VERSION_GREATER 0.5.4)) target_compile_definitions(rtlsdr_source PRIVATE RTLSDR_HAS_BIAS_TEE) endif() - target_link_libraries(rtlsdr_source ${RTLSDR_LIBRARIES} publisher stdc++) + target_include_directories(rtlsdr_source PUBLIC ${RTLSDR_INCLUDE_DIRS}) + target_link_libraries(rtlsdr_source ${RTLSDR_LINK_LIBRARIES} publisher stdc++) endif() add_library(nanomsg_source nanomsg_source.cc) diff --git a/src/goesrecv/airspy_source.h b/src/goesrecv/airspy_source.h index 09c3a27e..8115f30d 100644 --- a/src/goesrecv/airspy_source.h +++ b/src/goesrecv/airspy_source.h @@ -6,7 +6,7 @@ #include #include -#include +#include #include "source.h" From cecc0be502dcdbc75f68078b5cedeac76129d82a Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Wed, 27 Apr 2022 22:02:49 -0400 Subject: [PATCH 2/2] Strip prefixed v from librtlsdr versions Some versions of librtlsdr (including versions <= 0.5.4 built directly from source) have a leading 'v' on their versions as reported by pkg-config. This causes the version check for bias tees to yield incorrect results, preventing the use of a bias tee even if the underlying librtlsdr supports it. Removing the 'v' avoids this. --- src/goesrecv/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/goesrecv/CMakeLists.txt b/src/goesrecv/CMakeLists.txt index 85511b42..52f6e567 100644 --- a/src/goesrecv/CMakeLists.txt +++ b/src/goesrecv/CMakeLists.txt @@ -23,6 +23,16 @@ if(NOT RTLSDR_FOUND) message(WARNING "Unable to find librtlsdr") else() add_library(rtlsdr_source rtlsdr_source.cc) + + # Some rtlsdr versions begin with an extraneous 'v', such as older + # versions (<= 0.5.4) built from source, or the version provided by MacPorts. + # Newer versions built from source, as well as Debian packages, have + # versions that do not begin with this 'v'. + # Remove prefix 'v' here to handle all versions consistently. + if(RTLSDR_VERSION MATCHES "^v") + string(SUBSTRING ${RTLSDR_VERSION} 1 -1 RTLSDR_VERSION) + endif() + if((RTLSDR_VERSION VERSION_EQUAL 0.5.4) OR (RTLSDR_VERSION VERSION_GREATER 0.5.4)) target_compile_definitions(rtlsdr_source PRIVATE RTLSDR_HAS_BIAS_TEE)