stcai commented on a change in pull request #51: Be able to build examples with 
static client
URL: https://github.com/apache/rocketmq-client-cpp/pull/51#discussion_r245234797
 
 

 ##########
 File path: example/CMakeLists.txt
 ##########
 @@ -49,11 +49,11 @@ foreach(file ${files})
                ${Boost_LIBRARIES} ${LIBEVENT_LIBRARIES} ${JSONCPP_LIBRARIES})
         endif()
     else()
-        #if (BUILD_ROCKETMQ_SHARED)
+        if (BUILD_ROCKETMQ_SHARED)
            target_link_libraries (${basename} rocketmq_shared ${deplibs})
-        #else()
-       #    target_link_libraries (${basename} rocketmq_static ${deplibs})
-        #endif()
+        else()
+           target_link_libraries (${basename} rocketmq_static ${deplibs} 
${Boost_LIBRARIES} ${LIBEVENT_LIBRARIES} ${JSONCPP_LIBRARIES})
 
 Review comment:
   I have tested ”PullConsumer“。
   I know why these libraries didn't automaically add to dependent library list 
while compiling PullConsumer linking static mqclient, it's because we didn't 
link these object while compiling static mqclient.
   By the way, I just learn the when we use 'target_link_libraries' on static 
library, cmake dosn't really link these library on target library, it just 
remember the dependency of the target library on its own. 
   
https://stackoverflow.com/questions/52038439/static-libraries-linked-against-other-static-libraries-with-cmake-one-works-o

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to