You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2018/01/19 01:12:26 UTC

qpid-proton git commit: PROTON-1747: [C++ binding] link correctly to threads if necessary

Repository: qpid-proton
Updated Branches:
  refs/heads/master 7888d43d3 -> 0cae0686c


PROTON-1747: [C++ binding] link correctly to threads if necessary


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0cae0686
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0cae0686
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0cae0686

Branch: refs/heads/master
Commit: 0cae0686ca165c0675c5da5b9deeea8a34b146c0
Parents: 7888d43
Author: Andrew Stitcher <as...@apache.org>
Authored: Thu Jan 18 19:24:53 2018 -0500
Committer: Andrew Stitcher <as...@apache.org>
Committed: Thu Jan 18 20:08:05 2018 -0500

----------------------------------------------------------------------
 proton-c/CMakeLists.txt              | 4 ++--
 proton-c/bindings/cpp/CMakeLists.txt | 8 +++++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0cae0686/proton-c/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/CMakeLists.txt b/proton-c/CMakeLists.txt
index a8fd18e..2a0c75a 100644
--- a/proton-c/CMakeLists.txt
+++ b/proton-c/CMakeLists.txt
@@ -514,7 +514,7 @@ if (PROACTOR STREQUAL "epoll" OR (NOT PROACTOR AND NOT BUILD_PROACTOR))
   if (HAVE_EPOLL)
     set (PROACTOR_OK epoll)
     set (qpid-proton-proactor src/proactor/epoll.c src/proactor/proactor-internal.c)
-    set (PROACTOR_LIBS -lpthread)
+    set (PROACTOR_LIBS ${CMAKE_THREAD_LIBS_INIT} ${TIME_LIB})
     set_source_files_properties (${qpid-proton-proactor} PROPERTIES
       COMPILE_FLAGS "${COMPILE_WARNING_FLAGS} ${COMPILE_LANGUAGE_FLAGS} ${LTO}"
       )
@@ -610,7 +610,7 @@ add_library (
   )
 add_dependencies(qpid-proton-core generated_c_files)
 
-target_link_libraries (qpid-proton-core ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS})
+target_link_libraries (qpid-proton-core LINK_PRIVATE ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS})
 
 set_target_properties (
   qpid-proton-core

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0cae0686/proton-c/bindings/cpp/CMakeLists.txt
----------------------------------------------------------------------
diff --git a/proton-c/bindings/cpp/CMakeLists.txt b/proton-c/bindings/cpp/CMakeLists.txt
index a871d0a..b32b3f8 100644
--- a/proton-c/bindings/cpp/CMakeLists.txt
+++ b/proton-c/bindings/cpp/CMakeLists.txt
@@ -20,6 +20,9 @@ cmake_minimum_required(VERSION 2.8.12)
 
 enable_language(CXX)
 
+set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
+find_package(Threads)
+
 set (BUILD_CPP_03 OFF CACHE BOOL "Compile the C++ binding as C++03 even when C++11 is available")
 
 # This effectively checks for cmake version 3.1 or later
@@ -28,6 +31,7 @@ if (DEFINED CMAKE_CXX_COMPILE_FEATURES)
     set(STD 98)
   else ()
     set(STD 11)
+    list(APPEND PLATFORM_LIBS "${CMAKE_THREAD_LIBS_INIT}")
   endif ()
   set(CMAKE_CXX_STANDARD ${STD})
   set(CMAKE_CXX_EXTENSIONS OFF)
@@ -47,8 +51,10 @@ else ()
     if (ACCEPTS_CXX11)
       set(CXX_STANDARD "-std=c++11")
       set(CPP_DEFINITIONS "HAS_CPP11")
+      list(APPEND PLATFORM_LIBS "${CMAKE_THREAD_LIBS_INIT}")
     elseif(ACCEPTS_CXX0X)
       set(CXX_STANDARD "-std=c++0x")
+      list(APPEND PLATFORM_LIBS "${CMAKE_THREAD_LIBS_INIT}")
       include(cpp.cmake) # Compiler checks needed for C++0x as not all C++11 may be supported
     else()
       include(cpp.cmake) # Compiler checks needed as we have no idea whats going on here!
@@ -149,7 +155,7 @@ set_source_files_properties (
 
 add_library(qpid-proton-cpp SHARED ${qpid-proton-cpp-source})
 
-target_link_libraries (qpid-proton-cpp ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor)
+target_link_libraries (qpid-proton-cpp LINK_PRIVATE ${PLATFORM_LIBS} qpid-proton-core qpid-proton-proactor)
 
 set_target_properties (
   qpid-proton-cpp


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org