From 8247021f328bea8824536ebd7a702efee052da0c Mon Sep 17 00:00:00 2001 From: Carles Fernandez Date: Tue, 23 Aug 2022 14:11:06 +0200 Subject: [PATCH] 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