1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-03 01:10:49 +00:00

Merge branch 'castle055-773-protobuf-pkg-config-workaround' into next

This commit is contained in:
Carles Fernandez 2024-05-24 14:40:09 +02:00
commit efd1507672
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D

View File

@ -2621,6 +2621,16 @@ if(((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSI
endif()
else()
find_package(Protobuf)
if((CMAKE_BUILD_TYPE STREQUAL "Debug") AND Protobuf_FOUND AND absl_FOUND)
# This Regular Expression is used to convert the version string provided by `find_package(Protobuf)` into the
# appropriate binary version string. So, for instance, "4.25.3" becomes "25.3.0".
string(REGEX REPLACE "^[0-9]+\.([0-9]+\.[0-9]+)$" "\\1.0" PROTOBUF_LIBRARY_VERSION "${Protobuf_VERSION}")
if((PROTOBUF_LIBRARY_VERSION VERSION_GREATER_EQUAL "22") AND (PROTOBUF_LIBRARY_VERSION VERSION_LESS "26"))
pkg_check_modules(protobuf REQUIRED IMPORTED_TARGET protobuf=${PROTOBUF_LIBRARY_VERSION})
target_link_libraries(protobuf::libprotobuf INTERFACE PkgConfig::protobuf)
endif()
endif()
endif()
set_package_properties(Protobuf PROPERTIES
URL "https://protobuf.dev/"