[zeromq-dev] C++ Majordomo Pattern
Frank Hartmann
soundart at gmx.net
Wed Mar 27 19:46:45 CET 2013
Pieter Hintjens <ph at imatix.com> writes:
> On Wed, Mar 27, 2013 at 8:23 AM, Frank Hartmann <soundart at gmx.net> wrote:
>
>> I think the libczmq/CMakeLists.txt is causing this behaviour. Broken or not?
>>
>> I extracted the relevant lines and added to comments prefixed with "#XXX"
>> from current libczmq/CMakeLists.txt
>
> You're using cmake... not sure where the cmake files are, they're not
> in the CZMQ project afaics.
>
> Any reason you're not using the straight ./autogen.sh && ./configure
> && make process?
Hi Pieter,
sorry this was a typo, I was showing parts of the libzmq/CMakeLists.txt
and wrote wrongly libczmq/CMakeLists.txt
And I see now, that libcmq has both a cmake based build system and a
autoconf one.
I was using the cmake one, because I am more familar with
cmake.
I tried now to build with the autoconf flow and checked with ldd: The
resulting libzmq.so is linked against librt, while the one produced
with cmake is not linked against librt.
So I wanted to say in my last email:
I think the libzmq/CMakeLists.txt is causing this behaviour.
I extracted the relevant lines and added to comments prefixed with "#XXX"
from current libzmq/CMakeLists.txt
----------------------------------------------------------------------
find_library(RT_LIBRARY rt)
set(CMAKE_REQUIRED_LIBRARIES rt)
check_function_exists(clock_gettime HAVE_CLOCK_GETTIME)
set(CMAKE_REQUIRED_LIBRARIES )
#XXX linking of shared lib, notice _no_ ${RT_LIBRARY}
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
...
set(perf-tools local_lat ...)
add_executable(${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries(${perf-tool} libzmq)
#XXX...and during build of executables the build system _is_ using ${RT_LIBRARY}:
if(RT_LIBRARY)
target_link_libraries(${perf-tool} ${RT_LIBRARY})
endif()
----------------------------------------------------------------------
I have here now as patch:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6f18eda..00243e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -517,6 +517,11 @@ else()
endif()
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
+
+if("${HAVE_CLOCK_GETTIME}" STREQUAL "1")
+ target_link_libraries(libzmq ${RT_LIBRARY})
+endif()
+
if(HAVE_WS2_32)
target_link_libraries(libzmq ws2_32)
elseif(HAVE_WS2)
regards
Frank
More information about the zeromq-dev
mailing list