From 56ae0c043c39067034860da117d7bd85633c9bb4 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 13:02:04 +0200 Subject: [PATCH 1/7] CMake: Improve spdlog handling --- CMakeLists.txt | 20 ++--- cmake/Modules/FindFMT.cmake | 76 ----------------- cmake/Modules/FindSPDLOG.cmake | 84 ------------------- src/algorithms/PVT/adapters/CMakeLists.txt | 8 -- src/algorithms/channel/libs/CMakeLists.txt | 8 -- .../conditioner/adapters/CMakeLists.txt | 8 -- .../gnuradio_blocks/CMakeLists.txt | 8 -- .../gnuradio_blocks/CMakeLists.txt | 8 -- src/algorithms/libs/CMakeLists.txt | 8 -- .../gnuradio_blocks/CMakeLists.txt | 8 -- .../signal_generator/adapters/CMakeLists.txt | 8 -- .../signal_source/libs/CMakeLists.txt | 8 -- .../gnuradio_blocks/CMakeLists.txt | 8 -- src/core/monitor/CMakeLists.txt | 8 -- .../libs/CMakeLists.txt | 8 -- 15 files changed, 5 insertions(+), 271 deletions(-) delete mode 100644 cmake/Modules/FindFMT.cmake delete mode 100644 cmake/Modules/FindSPDLOG.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c38528a6..4da409a50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -645,24 +645,14 @@ endif() # spdlog - https://github.com/gabime/spdlog ################################################################################ if(GNURADIO_USES_SPDLOG) - find_package(SPDLOG REQUIRED) - set_package_properties(SPDLOG PROPERTIES - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) -endif() - - - -################################################################################ -# fmt - https://github.com/fmtlib/fmt -################################################################################ -if(GNURADIO_USES_SPDLOG) - find_package(FMT REQUIRED) - set_package_properties(FMT PROPERTIES + find_package(spdlog REQUIRED CONFIG) + set_package_properties(spdlog PROPERTIES + URL "https://github.com/gabime/spdlog" + DESCRIPTION "Very fast, header-only/compiled, C++ logging library" PURPOSE "Required by GNU Radio." TYPE REQUIRED ) + target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog) endif() diff --git a/cmake/Modules/FindFMT.cmake b/cmake/Modules/FindFMT.cmake deleted file mode 100644 index 49d091d8a..000000000 --- a/cmake/Modules/FindFMT.cmake +++ /dev/null @@ -1,76 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -# Locate header -find_path(FMT_INCLUDE_DIR fmt/core.h - HINTS ${FMT_ROOT_DIR}/include - PATHS - /usr/include - /usr/local/include - /opt/local/include -) - -# Locate library -find_library(FMT_LIBRARY NAMES fmt - HINTS ${FMT_ROOT_DIR}/lib ${FMT_ROOT_DIR}/lib64 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(FMT DEFAULT_MSG FMT_INCLUDE_DIR FMT_LIBRARY) - -set_package_properties(FMT PROPERTIES - URL "https://github.com/fmtlib/fmt" - DESCRIPTION "An open-source formatting library" -) - -# Add imported target. -if(FMT_FOUND) - set(FMT_INCLUDE_DIRS "${FMT_INCLUDE_DIR}") - - if(NOT TARGET fmt::fmt) - add_library(fmt::fmt UNKNOWN IMPORTED) - set_target_properties(fmt::fmt PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${FMT_INCLUDE_DIRS}" - ) - set_property(TARGET fmt::fmt APPEND PROPERTY - IMPORTED_LOCATION "${FMT_LIBRARY}" - ) - endif() -endif() diff --git a/cmake/Modules/FindSPDLOG.cmake b/cmake/Modules/FindSPDLOG.cmake deleted file mode 100644 index ac53fc870..000000000 --- a/cmake/Modules/FindSPDLOG.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# GNSS-SDR is a Global Navigation Satellite System software-defined receiver. -# This file is part of GNSS-SDR. -# -# SPDX-FileCopyrightText: 2021 C. Fernandez-Prades cfernandez(at)cttc.es -# SPDX-License-Identifier: BSD-3-Clause - -if(NOT COMMAND feature_summary) - include(FeatureSummary) -endif() - -# Locate header -find_path(SPDLOG_INCLUDE_DIR spdlog/spdlog.h - HINTS ${SPDLOG_ROOT_DIR}/include - PATHS - /usr/include - /usr/local/include - /opt/local/include -) - -# Locate library -find_library(SPDLOG_LIBRARY NAMES spdlog spdlogd - HINTS ${SPDLOG_ROOT_DIR}/lib ${SPDLOG_ROOT_DIR}/lib64 - PATHS - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu - /usr/lib/i386-linux-gnu - /usr/lib/arm-linux-gnueabihf - /usr/lib/arm-linux-gnueabi - /usr/lib/aarch64-linux-gnu - /usr/lib/mipsel-linux-gnu - /usr/lib/mips-linux-gnu - /usr/lib/mips64el-linux-gnuabi64 - /usr/lib/powerpc-linux-gnu - /usr/lib/powerpc64-linux-gnu - /usr/lib/powerpc64le-linux-gnu - /usr/lib/powerpc-linux-gnuspe - /usr/lib/hppa-linux-gnu - /usr/lib/s390x-linux-gnu - /usr/lib/i386-gnu - /usr/lib/hppa-linux-gnu - /usr/lib/x86_64-kfreebsd-gnu - /usr/lib/i386-kfreebsd-gnu - /usr/lib/m68k-linux-gnu - /usr/lib/sh4-linux-gnu - /usr/lib/sparc64-linux-gnu - /usr/lib/x86_64-linux-gnux32 - /usr/lib/alpha-linux-gnu - /usr/lib/riscv64-linux-gnu - /usr/local/lib - /usr/local/lib64 - /opt/local/lib -) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(SPDLOG DEFAULT_MSG SPDLOG_INCLUDE_DIR SPDLOG_LIBRARY) - -set_package_properties(SPDLOG PROPERTIES - URL "https://github.com/gabime/spdlog" - DESCRIPTION "Very fast, header-only/compiled, C++ logging library" -) - -# Add imported target. -if(SPDLOG_FOUND) - set(SPDLOG_INCLUDE_DIRS "${SPDLOG_INCLUDE_DIR}") - - if(NOT TARGET spdlog::spdlog) - add_library(spdlog::spdlog UNKNOWN IMPORTED) - set_target_properties(spdlog::spdlog PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${SPDLOG_INCLUDE_DIRS}" - ) - set_property(TARGET spdlog::spdlog APPEND PROPERTY - IMPORTED_LOCATION "${SPDLOG_LIBRARY}" - ) - endif() - - if(CMAKE_VERSION VERSION_GREATER 3.11.0) - target_compile_definitions(spdlog::spdlog INTERFACE -DSPDLOG_FMT_EXTERNAL=1) - else() - set_property(TARGET spdlog::spdlog APPEND PROPERTY - INTERFACE_COMPILE_DEFINITIONS SPDLOG_FMT_EXTERNAL=1 - ) - endif() -endif() diff --git a/src/algorithms/PVT/adapters/CMakeLists.txt b/src/algorithms/PVT/adapters/CMakeLists.txt index 3cf70fe95..6b9ff33e6 100644 --- a/src/algorithms/PVT/adapters/CMakeLists.txt +++ b/src/algorithms/PVT/adapters/CMakeLists.txt @@ -39,14 +39,6 @@ if(USE_OLD_BOOST_MATH_COMMON_FACTOR) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(pvt_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(pvt_adapters diff --git a/src/algorithms/channel/libs/CMakeLists.txt b/src/algorithms/channel/libs/CMakeLists.txt index 90607d700..63e0d72d8 100644 --- a/src/algorithms/channel/libs/CMakeLists.txt +++ b/src/algorithms/channel/libs/CMakeLists.txt @@ -54,14 +54,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(channel_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) diff --git a/src/algorithms/conditioner/adapters/CMakeLists.txt b/src/algorithms/conditioner/adapters/CMakeLists.txt index 265965e67..7c24d008e 100644 --- a/src/algorithms/conditioner/adapters/CMakeLists.txt +++ b/src/algorithms/conditioner/adapters/CMakeLists.txt @@ -42,14 +42,6 @@ target_link_libraries(conditioner_adapters Glog::glog ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(conditioner_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(conditioner_adapters PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt index a0e1f2ddc..5a05385c2 100644 --- a/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/data_type_adapter/gnuradio_blocks/CMakeLists.txt @@ -55,14 +55,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(data_type_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - set_property(TARGET data_type_gr_blocks APPEND PROPERTY INTERFACE_INCLUDE_DIRECTORIES $ diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index c652131ea..5b1a6762a 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -55,14 +55,6 @@ if(LOG4CPP_FOUND) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(input_filter_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(input_filter_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/libs/CMakeLists.txt b/src/algorithms/libs/CMakeLists.txt index e8f0d6366..1e31cf4c3 100644 --- a/src/algorithms/libs/CMakeLists.txt +++ b/src/algorithms/libs/CMakeLists.txt @@ -119,14 +119,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(algorithms_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(FILESYSTEM_FOUND) target_compile_definitions(algorithms_libs PUBLIC -DHAS_STD_FILESYSTEM=1) if(find_experimental) diff --git a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt index 7f6537ccf..225518612 100644 --- a/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/observables/gnuradio_blocks/CMakeLists.txt @@ -37,14 +37,6 @@ target_link_libraries(obs_gr_blocks Gnuradio::pmt ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(obs_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(obs_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/algorithms/signal_generator/adapters/CMakeLists.txt b/src/algorithms/signal_generator/adapters/CMakeLists.txt index e8486b326..c430af3c2 100644 --- a/src/algorithms/signal_generator/adapters/CMakeLists.txt +++ b/src/algorithms/signal_generator/adapters/CMakeLists.txt @@ -44,14 +44,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_generator_adapters - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_CLANG_TIDY) if(CLANG_TIDY_EXE) set_target_properties(signal_generator_adapters diff --git a/src/algorithms/signal_source/libs/CMakeLists.txt b/src/algorithms/signal_source/libs/CMakeLists.txt index 34cb13e88..2823283b7 100644 --- a/src/algorithms/signal_source/libs/CMakeLists.txt +++ b/src/algorithms/signal_source/libs/CMakeLists.txt @@ -80,14 +80,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_source_libs - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(ENABLE_FMCOMMS2 OR ENABLE_AD9361) target_link_libraries(signal_source_libs PUBLIC diff --git a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt index d6bed4f97..c71184aa8 100644 --- a/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/telemetry_decoder/gnuradio_blocks/CMakeLists.txt @@ -69,14 +69,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(telemetry_decoder_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(telemetry_decoder_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces diff --git a/src/core/monitor/CMakeLists.txt b/src/core/monitor/CMakeLists.txt index 4f6211a40..cfd2cdab3 100644 --- a/src/core/monitor/CMakeLists.txt +++ b/src/core/monitor/CMakeLists.txt @@ -73,14 +73,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(GNURADIO_USES_SPDLOG) - target_link_libraries(core_monitor - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_BOOST_ASIO_IO_CONTEXT) target_compile_definitions(core_monitor PUBLIC diff --git a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt index 6740932fb..53545ef44 100644 --- a/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt +++ b/src/tests/unit-tests/signal-processing-blocks/libs/CMakeLists.txt @@ -53,14 +53,6 @@ target_include_directories(signal_processing_testing_lib ${GNSSSDR_SOURCE_DIR}/src/tests/common-files ) -if(GNURADIO_USES_SPDLOG) - target_link_libraries(signal_processing_testing_lib - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - if(USE_GENERIC_LAMBDAS) set(has_generic_lambdas HAS_GENERIC_LAMBDA=1) set(no_has_generic_lambdas HAS_GENERIC_LAMBDA=0) From 5186b737b745a6f59937e78da80127ee0b066501 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 13:14:59 +0200 Subject: [PATCH 2/7] CMake: remove leftovers --- src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt index ae521eeb9..9a7ea4e5d 100644 --- a/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/resampler/gnuradio_blocks/CMakeLists.txt @@ -50,14 +50,6 @@ if(GNURADIO_USES_STD_POINTERS) ) endif() -if(NOT GNURADIO_USES_LOG4CPP) - target_link_libraries(resampler_gr_blocks - PUBLIC - fmt::fmt - spdlog::spdlog - ) -endif() - target_include_directories(resampler_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces From 8247021f328bea8824536ebd7a702efee052da0c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 14:11:06 +0200 Subject: [PATCH 3/7] CMake: Move log4cpp/spdlog handling to the GNURADIO cmake module --- CMakeLists.txt | 29 ------------------- cmake/Modules/FindGNURADIO.cmake | 17 +++++++++-- docs/CHANGELOG.md | 1 + .../gnuradio_blocks/CMakeLists.txt | 7 ----- 4 files changed, 16 insertions(+), 38 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4da409a50..02f3096be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -628,35 +628,6 @@ endif() -################################################################################ -# Log4cpp - http://log4cpp.sourceforge.net/ -################################################################################ -if(GNURADIO_USES_LOG4CPP) - find_package(LOG4CPP) - set_package_properties(LOG4CPP PROPERTIES - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) -endif() - - - -################################################################################ -# spdlog - https://github.com/gabime/spdlog -################################################################################ -if(GNURADIO_USES_SPDLOG) - find_package(spdlog REQUIRED CONFIG) - set_package_properties(spdlog PROPERTIES - URL "https://github.com/gabime/spdlog" - DESCRIPTION "Very fast, header-only/compiled, C++ logging library" - PURPOSE "Required by GNU Radio." - TYPE REQUIRED - ) - target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog) -endif() - - - ################################################################################ # Detect availability of std::filesystem and set C++ standard accordingly ################################################################################ diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index e7a561018..400885ede 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -411,10 +411,23 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) endif() endforeach() if(${_uses_log4cpp}) - set(GNURADIO_USES_LOG4CPP TRUE) + find_package(LOG4CPP) + set_package_properties(LOG4CPP PROPERTIES + PURPOSE "Required by GNU Radio." + TYPE REQUIRED + ) + target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) endif() if(${_uses_spdlog}) - set(GNURADIO_USES_SPDLOG TRUE) + find_package(spdlog REQUIRED CONFIG) + set_package_properties(spdlog PROPERTIES + URL "https://github.com/gabime/spdlog" + DESCRIPTION "Very fast, header-only/compiled, C++ logging library" + PURPOSE "Required by GNU Radio." + TYPE REQUIRED + ) + target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog) + target_link_libraries(Gnuradio::blocks INTERFACE spdlog::spdlog) endif() endif() endif() diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 91db3563c..512b55ccc 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -62,6 +62,7 @@ All notable changes to GNSS-SDR will be documented in this file. - The configuration options at building time `-DENABLE_OWN_GLOG`, `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` and `OFF` without the need to start from an empty buiding folder. +- Improved CMake handling of the spdlog library used by GNU Radio >= 3.10. ### Improvements in Usability: diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index 5b1a6762a..c65727296 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -48,13 +48,6 @@ target_link_libraries(input_filter_gr_blocks Volk::volk ) -if(LOG4CPP_FOUND) - target_link_libraries(input_filter_gr_blocks - PRIVATE - Log4cpp::log4cpp - ) -endif() - target_include_directories(input_filter_gr_blocks PUBLIC ${GNSSSDR_SOURCE_DIR}/src/core/interfaces From e15faa7b670ae595082fc2aaa3fc05434820a5db Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 15:12:09 +0200 Subject: [PATCH 4/7] Fix for old CMake --- cmake/Modules/FindGNURADIO.cmake | 6 +++++- src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 400885ede..a8f0b2a90 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -416,7 +416,11 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) PURPOSE "Required by GNU Radio." TYPE REQUIRED ) - target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) + if(CMAKE_VERSION VERSION_GREATER 3.0) + target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) + else() + set(LOG4CPP_WITH_OLD_CMAKE TRUE) + endif() endif() if(${_uses_spdlog}) find_package(spdlog REQUIRED CONFIG) diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index c65727296..51113a267 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -53,6 +53,13 @@ target_include_directories(input_filter_gr_blocks ${GNSSSDR_SOURCE_DIR}/src/core/interfaces ) +if(LOG4CPP_WITH_OLD_CMAKE) + target_link_libraries(input_filter_gr_blocks + PRIVATE + Log4cpp::log4cpp + ) +endif() + if(GNURADIO_USES_STD_POINTERS) target_compile_definitions(input_filter_gr_blocks PUBLIC -DGNURADIO_USES_STD_POINTERS=1 From 1a4e9dc2740b6ad18e2dccc3e70e84ec074bfc8b Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 15:13:15 +0200 Subject: [PATCH 5/7] Add missing include (fix building in fedora-rawhide) --- src/utils/front-end-cal/main.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/front-end-cal/main.cc b/src/utils/front-end-cal/main.cc index 42d7a7601..5d7122686 100644 --- a/src/utils/front-end-cal/main.cc +++ b/src/utils/front-end-cal/main.cc @@ -60,6 +60,7 @@ #include #include // for ctime #include +#include // for std::setiosflags, std::setprecision #include #include #include From 6bf7cd9f30b397a9fd232978fee5941d015c74e0 Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 15:44:50 +0200 Subject: [PATCH 6/7] Fix for old CMake --- cmake/Modules/FindGNURADIO.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index a8f0b2a90..0fe062dc3 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -416,7 +416,7 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) PURPOSE "Required by GNU Radio." TYPE REQUIRED ) - if(CMAKE_VERSION VERSION_GREATER 3.0) + if(CMAKE_VERSION VERSION_GREATER 3.8) target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) else() set(LOG4CPP_WITH_OLD_CMAKE TRUE) From 1a6dc7263d4be972015e43ad9fd49a63ee8c77ac Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 21:29:54 +0200 Subject: [PATCH 7/7] CMake: fix for old CMake --- cmake/Modules/FindGNURADIO.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/Modules/FindGNURADIO.cmake b/cmake/Modules/FindGNURADIO.cmake index 0fe062dc3..32656e8ae 100644 --- a/cmake/Modules/FindGNURADIO.cmake +++ b/cmake/Modules/FindGNURADIO.cmake @@ -416,7 +416,7 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) PURPOSE "Required by GNU Radio." TYPE REQUIRED ) - if(CMAKE_VERSION VERSION_GREATER 3.8) + if(CMAKE_VERSION VERSION_GREATER 3.13) target_link_libraries(Gnuradio::filter INTERFACE Log4cpp::log4cpp) else() set(LOG4CPP_WITH_OLD_CMAKE TRUE) @@ -430,6 +430,7 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS) PURPOSE "Required by GNU Radio." TYPE REQUIRED ) + set(GNURADIO_USES_SPDLOG TRUE) target_link_libraries(Gnuradio::runtime INTERFACE spdlog::spdlog) target_link_libraries(Gnuradio::blocks INTERFACE spdlog::spdlog) endif()