CMake: Move log4cpp/spdlog handling to the GNURADIO cmake module

This commit is contained in:
Carles Fernandez 2022-08-23 14:11:06 +02:00
parent 5186b737b7
commit 8247021f32
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
4 changed files with 16 additions and 38 deletions

View File

@ -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 # Detect availability of std::filesystem and set C++ standard accordingly
################################################################################ ################################################################################

View File

@ -411,10 +411,23 @@ if(GNURADIO_RUNTIME_INCLUDE_DIRS)
endif() endif()
endforeach() endforeach()
if(${_uses_log4cpp}) 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() endif()
if(${_uses_spdlog}) 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() endif()
endif() endif()

View File

@ -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`, - The configuration options at building time `-DENABLE_OWN_GLOG`,
`-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON` `-DENABLE_OWN_ARMADILLO`, and `-DENABLE_OWN_GNSSTK` can now be switched `ON`
and `OFF` without the need to start from an empty buiding folder. 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: ### Improvements in Usability:

View File

@ -48,13 +48,6 @@ target_link_libraries(input_filter_gr_blocks
Volk::volk Volk::volk
) )
if(LOG4CPP_FOUND)
target_link_libraries(input_filter_gr_blocks
PRIVATE
Log4cpp::log4cpp
)
endif()
target_include_directories(input_filter_gr_blocks target_include_directories(input_filter_gr_blocks
PUBLIC PUBLIC
${GNSSSDR_SOURCE_DIR}/src/core/interfaces ${GNSSSDR_SOURCE_DIR}/src/core/interfaces