1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-10-28 22:17:39 +00:00

Improve dependency version identification in CMake modules

This commit is contained in:
Carles Fernandez
2019-06-24 00:24:08 +02:00
parent bfae31390f
commit bbe7707282
6 changed files with 61 additions and 12 deletions

View File

@@ -30,6 +30,10 @@ if(NOT COMMAND feature_summary)
include(FeatureSummary)
endif()
set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
include(FindPkgConfig)
pkg_check_modules(PC_LOG4CPP log4cpp QUIET)
if(LOG4CPP_INCLUDE_DIR)
# Already in cache, be silent
set(LOG4CPP_FIND_QUIETLY TRUE)
@@ -41,6 +45,7 @@ find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh
/usr/include
${LOG4CPP_ROOT}/include
$ENV{LOG4CPP_ROOT}/include
${PC_LOG4CPP_INCLUDEDIR}
)
if(LOG4CPP_INCLUDE_DIR)
@@ -61,7 +66,7 @@ set(LOG4CPP_NAMES log4cpp)
find_library(LOG4CPP_LIBRARY
NAMES ${LOG4CPP_NAMES}
HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib
${PC_LIBDIR}
${PC_LOG4CPP_LIBDIR}
${CMAKE_INSTALL_PREFIX}/lib/
PATHS /usr/local/lib
/usr/lib/x86_64-linux-gnu
@@ -115,13 +120,23 @@ set_package_properties(LOG4CPP PROPERTIES
URL "http://log4cpp.sourceforge.net/"
)
if(LOG4CPP_FOUND AND LOG4CPP_READY_FOR_CXX17)
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging to files (the version found is C++17-ready)"
)
if(LOG4CPP_FOUND AND PC_LOG4CPP_VERSION)
set(LOG4CPP_VERSION ${PC_LOG4CPP_VERSION})
endif()
if(LOG4CPP_FOUND AND LOG4CPP_VERSION)
if(LOG4CPP_READY_FOR_CXX17)
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging (found: v${LOG4CPP_VERSION}, C++17-ready)"
)
else()
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging (found: v${LOG4CPP_VERSION})"
)
endif()
else()
set_package_properties(LOG4CPP PROPERTIES
DESCRIPTION "Library of C++ classes for flexible logging to files"
DESCRIPTION "Library of C++ classes for flexible logging"
)
endif()