0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-26 06:41:03 +08:00

linkage is now homogeneous for both targets libzmq and libzmq-static

all calls to target_link_libraries are now at the same location
This commit is contained in:
Salvo Virga 2018-01-15 00:36:02 +01:00
parent 2540e1a609
commit 9d6a5f3c2f

View File

@ -43,11 +43,6 @@ elseif (WITH_LIBSODIUM)
if (SODIUM_FOUND)
message (STATUS "Using libsodium for CURVE security")
include_directories (${SODIUM_INCLUDE_DIRS})
# On Solaris, libsodium depends on libssp
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries (libzmq ssp)
endif ()
set (ZMQ_USE_LIBSODIUM 1)
set (ZMQ_HAVE_CURVE 1)
set (pkg_config_libs_private "${pkg_config_libs_private} -lsodium")
@ -764,7 +759,6 @@ if (MSVC)
set( CMAKE_STATIC_LINKER_FLAGS /ignore:4221 )
if (BUILD_SHARED)
add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
set_target_properties (libzmq PROPERTIES
PUBLIC_HEADER "${public_headers}"
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
@ -798,7 +792,6 @@ else ()
if (BUILD_SHARED)
add_library (libzmq SHARED $<TARGET_OBJECTS:objects> ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig} ${CMAKE_CURRENT_BINARY_DIR}/version.rc)
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
# NOTE: the SOVERSION and VERSION MUST be the same as the one generated by libtool! It is NOT the same as the version of the package.
set_target_properties (libzmq PROPERTIES
COMPILE_DEFINITIONS "DLL_EXPORT"
@ -849,11 +842,16 @@ foreach (target ${target_outputs})
endforeach()
if (BUILD_SHARED)
target_link_libraries (libzmq ${CMAKE_THREAD_LIBS_INIT})
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if (SODIUM_FOUND)
target_link_libraries (libzmq ${SODIUM_LIBRARIES})
# On Solaris, libsodium depends on libssp
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries (libzmq ssp)
endif ()
endif ()
if (HAVE_WS2_32)
target_link_libraries (libzmq ws2_32)
elseif (HAVE_WS2)
@ -873,6 +871,36 @@ if (BUILD_SHARED)
endif ()
endif ()
if (BUILD_STATIC)
target_link_libraries (libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
if (SODIUM_FOUND)
target_link_libraries (libzmq-static ${SODIUM_LIBRARIES})
# On Solaris, libsodium depends on libssp
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
target_link_libraries (libzmq-static ssp)
endif ()
endif ()
if (HAVE_WS2_32)
target_link_libraries (libzmq-static ws2_32)
elseif (HAVE_WS2)
target_link_libraries (libzmq-static ws2)
endif ()
if (HAVE_RPCRT4)
target_link_libraries (libzmq-static rpcrt4)
endif ()
if (HAVE_IPHLAPI)
target_link_libraries (libzmq-static iphlpapi)
endif ()
if (RT_LIBRARY)
target_link_libraries (libzmq-static -lrt)
endif ()
endif ()
if (BUILD_SHARED)
set (perf-tools local_lat
remote_lat
@ -890,11 +918,7 @@ if (BUILD_SHARED)
if (WITH_PERF_TOOL)
foreach (perf-tool ${perf-tools})
add_executable (${perf-tool} perf/${perf-tool}.cpp)
target_link_libraries (${perf-tool} libzmq ${OPTIONAL_LIBRARIES})
if (RT_LIBRARY)
target_link_libraries (${perf-tool} -lrt)
endif ()
target_link_libraries (${perf-tool} libzmq)
if (ZMQ_BUILD_FRAMEWORK)
# Copy perf-tools binaries into Framework