FindProtobuf: Link to threads dependency only when Protobuf is found

Since commit 03454b0d0d (FindProtobuf: Add missing link dependencies on
threads, 2018-10-31, v3.13.0-rc3~10^2) we add the threads library to the
list of libraries needed for Protobuf.  Update the logic to do this only
when a real protobuf library is actually found.

Fixes: #21161
This commit is contained in:
Brad King
2020-09-22 08:25:51 -04:00
parent 44c5f5d4ec
commit ae41216878

View File

@@ -388,7 +388,7 @@ function(_protobuf_find_libraries name filename)
select_library_configurations(${name})
if(UNIX AND Threads_FOUND)
if(UNIX AND Threads_FOUND AND ${name}_LIBRARY)
list(APPEND ${name}_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
endif()