1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-07-05 19:33:15 +00:00

Conditionally link protobuf to its dependencies in Debug mode

This is a workaround to the issue of certain versions of protobuf not advertising their dependencies when using `find_package(Protobuf)`.
This commit is contained in:
Victor Castillo 2024-05-24 02:16:07 +02:00
parent f80c5373b7
commit ecbc65028f
No known key found for this signature in database
GPG Key ID: 8EF1FC8B7182F608

View File

@ -2621,6 +2621,15 @@ 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)
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"))
find_package(PkgConfig REQUIRED)
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/"