summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-05-28 14:42:29 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-05-28 14:42:29 (GMT)
commit93e9291da73b845ac8c7e70921a4deb400f4f1fc (patch)
treec7d78914c76a1e8152e611e521818d3e30583f16 /Modules
parent7cde91cc8c0d2a2152183c1bb40ebae36ce60307 (diff)
parent8961c4b68bdf3202be0451a68418922cf869439c (diff)
downloadCMake-93e9291da73b845ac8c7e70921a4deb400f4f1fc.zip
CMake-93e9291da73b845ac8c7e70921a4deb400f4f1fc.tar.gz
CMake-93e9291da73b845ac8c7e70921a4deb400f4f1fc.tar.bz2
Merge topic 'fix-protobuf-threads'
8961c4b FindProtobuf: also find pthread
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindProtobuf.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/FindProtobuf.cmake b/Modules/FindProtobuf.cmake
index af0c2dd..2972198 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