mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-01-31 11:19:18 +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:
parent
f80c5373b7
commit
ecbc65028f
@ -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/"
|
||||
|
Loading…
Reference in New Issue
Block a user