diff --git a/cmake/Modules/FindLOG4CPP.cmake b/cmake/Modules/FindLOG4CPP.cmake index 283c3ddf9..29c7308fa 100644 --- a/cmake/Modules/FindLOG4CPP.cmake +++ b/cmake/Modules/FindLOG4CPP.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2011-2018 (see AUTHORS file for a list of contributors) +# Copyright (C) 2011-2019 (see AUTHORS file for a list of contributors) # # This file is part of GNSS-SDR. # @@ -21,7 +21,10 @@ # LOG4CPP_INCLUDE_DIR - where to find LOG4CPP.h, etc. # LOG4CPP_LIBRARIES - List of libraries when using LOG4CPP. # LOG4CPP_FOUND - True if LOG4CPP found. - +# +# Provides the following imported target: +# Log4cpp::log4cpp +# if(LOG4CPP_INCLUDE_DIR) # Already in cache, be silent @@ -90,3 +93,18 @@ endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LOG4CPP DEFAULT_MSG LOG4CPP_INCLUDE_DIRS LOG4CPP_LIBRARIES) + +if (LOG4CPP_FOUND AND NOT TARGET Log4cpp::log4cpp) + add_library(Log4cpp::log4cpp SHARED IMPORTED) + set_target_properties(Log4cpp::log4cpp PROPERTIES + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${LOG4CPP_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${LOG4CPP_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${LOG4CPP_LIBRARIES}" + ) +endif() + +mark_as_advanced( + LOG4CPP_LIBRARIES + LOG4CPP_INCLUDE_DIRS +) diff --git a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt index 29b909273..b22aa79c4 100644 --- a/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt +++ b/src/algorithms/input_filter/gnuradio_blocks/CMakeLists.txt @@ -48,7 +48,7 @@ target_link_libraries(input_filter_gr_blocks PRIVATE Gflags::gflags Glog::glog - ${LOG4CPP_LIBRARIES} + Log4cpp::log4cpp ) set_property(TARGET input_filter_gr_blocks