From 317dbdb79761ef65e45c7358cfc7571c6afa54ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20THIERRY?= Date: Tue, 23 Dec 2014 09:30:24 +0100 Subject: Imported Upstream version 2.8.12.2 --- Modules/FindProtobuf.cmake | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Modules/FindProtobuf.cmake') diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake index af0c2ddf0..2972198b3 100644 --- a/Modules/FindProtobuf.cmake +++ b/Modules/FindProtobuf.cmake @@ -156,6 +156,16 @@ function(_protobuf_find_libraries name filename) endif() 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. # @@ -190,6 +200,9 @@ if(MSVC) set(CMAKE_FIND_LIBRARY_PREFIXES "${PROTOBUF_ORIG_FIND_LIBRARY_PREFIXES}") endif() +if(UNIX) + _protobuf_find_threads() +endif() # Find the include directory find_path(PROTOBUF_INCLUDE_DIR -- cgit v1.2.3