Commit 8961c4b6 authored by Matthew Woehlke's avatar Matthew Woehlke

FindProtobuf: also find pthread

Modify FindProtobuf.cmake to find the pthread library on UNIX platforms,
and to add the same to PROTOBUF_LIBRARIES, as this is a link dependency
of libraries using the protobuf headers.
parent 619fa2cc
...@@ -156,6 +156,16 @@ function(_protobuf_find_libraries name filename) ...@@ -156,6 +156,16 @@ function(_protobuf_find_libraries name filename)
endif() endif()
endfunction() endfunction()
# Internal function: find threads library
function(_protobuf_find_threads)
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
find_package(Threads)
if(Threads_FOUND)
list(APPEND PROTOBUF_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBRARIES}" PARENT_SCOPE)
endif()
endfunction()
# #
# Main. # Main.
# #
...@@ -190,6 +200,9 @@ if(MSVC) ...@@ -190,6 +200,9 @@ if(MSVC)
set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}")
endif() endif()
if(UNIX)
_protobuf_find_threads()
endif()
# Find the include directory # Find the include directory
find_path(PROTOBUF_INCLUDE_DIR find_path(PROTOBUF_INCLUDE_DIR
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment