mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-26 23:01:04 +08:00
Fix windows compilation
This commit is contained in:
parent
c7fea39005
commit
f7d1c159d4
@ -44,7 +44,7 @@ elseif (WITH_LIBSODIUM)
|
||||
|
||||
# On Solaris, libsodium depends on libssp
|
||||
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
|
||||
target_link_libraries (libzmq ssp)
|
||||
target_link_libraries (zmq-shared ssp)
|
||||
endif ()
|
||||
set (ZMQ_USE_LIBSODIUM 1)
|
||||
set (ZMQ_HAVE_CURVE 1)
|
||||
@ -694,7 +694,7 @@ endforeach ()
|
||||
|
||||
if (ZMQ_BUILD_FRAMEWORK)
|
||||
add_custom_command (
|
||||
TARGET libzmq
|
||||
TARGET zmq-shared
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E make_directory "${CMAKE_LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION}/MacOS"
|
||||
@ -726,17 +726,18 @@ endif ()
|
||||
# output
|
||||
|
||||
if (MSVC)
|
||||
add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in)
|
||||
target_link_libraries (libzmq ${OPTIONAL_LIBRARIES})
|
||||
set_target_properties (libzmq PROPERTIES
|
||||
add_library (zmq-shared SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${CMAKE_CURRENT_BINARY_DIR}/NSIS.template.in)
|
||||
target_link_libraries (zmq-shared ${OPTIONAL_LIBRARIES})
|
||||
set_target_properties (zmq-shared PROPERTIES
|
||||
PUBLIC_HEADER "${public_headers}"
|
||||
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||
DEBUG_POSTFIX "${MSVC_TOOLSET}-mt-gd-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin"
|
||||
COMPILE_DEFINITIONS "DLL_EXPORT")
|
||||
add_library (libzmq-static STATIC ${sources})
|
||||
set_target_properties (libzmq-static PROPERTIES
|
||||
COMPILE_DEFINITIONS "DLL_EXPORT"
|
||||
OUTPUT_NAME "libzmq")
|
||||
add_library (zmq-static STATIC ${sources})
|
||||
set_target_properties (zmq-static PROPERTIES
|
||||
PUBLIC_HEADER "${public_headers}"
|
||||
RELEASE_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||
RELWITHDEBINFO_POSTFIX "${MSVC_TOOLSET}-mt-s-${ZMQ_VERSION_MAJOR}_${ZMQ_VERSION_MINOR}_${ZMQ_VERSION_PATCH}"
|
||||
@ -744,17 +745,17 @@ if (MSVC)
|
||||
COMPILE_FLAGS "/DZMQ_STATIC"
|
||||
OUTPUT_NAME "libzmq")
|
||||
else ()
|
||||
add_library (libzmq SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||
add_library (zmq-shared SHARED ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||
# NOTE: the SOVERSION MUST be the same as the one generated by libtool!
|
||||
set_target_properties (libzmq PROPERTIES
|
||||
set_target_properties (zmq-shared PROPERTIES
|
||||
COMPILE_DEFINITIONS "DLL_EXPORT"
|
||||
PUBLIC_HEADER "${public_headers}"
|
||||
VERSION ${ZMQ_VERSION}
|
||||
SOVERSION "5.1.3"
|
||||
OUTPUT_NAME "libzmq"
|
||||
PREFIX "")
|
||||
OUTPUT_NAME "zmq"
|
||||
PREFIX "lib")
|
||||
if (ZMQ_BUILD_FRAMEWORK)
|
||||
set_target_properties (libzmq PROPERTIES
|
||||
set_target_properties (zmq-shared PROPERTIES
|
||||
FRAMEWORK TRUE
|
||||
MACOSX_FRAMEWORK_IDENTIFIER "org.zeromq.libzmq"
|
||||
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${ZMQ_VERSION}
|
||||
@ -766,15 +767,15 @@ else ()
|
||||
set_source_files_properties (${zmq-pkgconfig} PROPERTIES
|
||||
MACOSX_PACKAGE_LOCATION lib/pkgconfig)
|
||||
endif ()
|
||||
add_library (libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||
set_target_properties (libzmq-static PROPERTIES
|
||||
add_library (zmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||
set_target_properties (zmq-static PROPERTIES
|
||||
PUBLIC_HEADER "${public_headers}"
|
||||
COMPILE_DEFINITIONS "ZMQ_STATIC"
|
||||
OUTPUT_NAME "libzmq"
|
||||
PREFIX "")
|
||||
OUTPUT_NAME "zmq"
|
||||
PREFIX "lib")
|
||||
endif ()
|
||||
|
||||
foreach (target libzmq libzmq-static)
|
||||
foreach (target zmq-shared zmq-static)
|
||||
target_include_directories (${target}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
@ -783,27 +784,27 @@ foreach (target libzmq libzmq-static)
|
||||
)
|
||||
endforeach()
|
||||
|
||||
target_link_libraries (libzmq ${CMAKE_THREAD_LIBS_INIT})
|
||||
target_link_libraries (zmq-shared ${CMAKE_THREAD_LIBS_INIT})
|
||||
|
||||
if (SODIUM_FOUND)
|
||||
target_link_libraries (libzmq ${SODIUM_LIBRARIES})
|
||||
target_link_libraries (zmq-shared ${SODIUM_LIBRARIES})
|
||||
endif ()
|
||||
if (HAVE_WS2_32)
|
||||
target_link_libraries (libzmq ws2_32)
|
||||
target_link_libraries (zmq-shared ws2_32)
|
||||
elseif (HAVE_WS2)
|
||||
target_link_libraries (libzmq ws2)
|
||||
target_link_libraries (zmq-shared ws2)
|
||||
endif ()
|
||||
|
||||
if (HAVE_RPCRT4)
|
||||
target_link_libraries (libzmq rpcrt4)
|
||||
target_link_libraries (zmq-shared rpcrt4)
|
||||
endif ()
|
||||
|
||||
if (HAVE_IPHLAPI)
|
||||
target_link_libraries (libzmq iphlpapi)
|
||||
target_link_libraries (zmq-shared iphlpapi)
|
||||
endif ()
|
||||
|
||||
if (RT_LIBRARY)
|
||||
target_link_libraries (libzmq ${RT_LIBRARY})
|
||||
target_link_libraries (zmq-shared ${RT_LIBRARY})
|
||||
endif ()
|
||||
|
||||
set (perf-tools local_lat
|
||||
@ -822,7 +823,7 @@ endif ()
|
||||
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})
|
||||
target_link_libraries (${perf-tool} zmq-shared ${OPTIONAL_LIBRARIES})
|
||||
|
||||
if (RT_LIBRARY)
|
||||
target_link_libraries (${perf-tool} ${RT_LIBRARY})
|
||||
@ -831,7 +832,7 @@ if (WITH_PERF_TOOL)
|
||||
if (ZMQ_BUILD_FRAMEWORK)
|
||||
# Copy perf-tools binaries into Framework
|
||||
add_custom_command (
|
||||
TARGET libzmq ${perf-tool}
|
||||
TARGET zmq-shared ${perf-tool}
|
||||
POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
ARGS -E copy "$<TARGET_FILE:${perf-tool}>" "${LIBRARY_OUTPUT_PATH}/ZeroMQ.framework/Versions/${ZMQ_VERSION_STRING}/MacOS/${perf-tool}"
|
||||
@ -861,14 +862,14 @@ endif ()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if (MSVC)
|
||||
install (TARGETS libzmq libzmq-static
|
||||
install (TARGETS zmq-shared zmq-static
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT SDK)
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
install (TARGETS libzmq libzmq-static
|
||||
install (TARGETS zmq-shared zmq-static
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
@ -878,13 +879,13 @@ if (MSVC)
|
||||
COMPONENT SDK)
|
||||
endif ()
|
||||
else ()
|
||||
install (TARGETS libzmq
|
||||
install (TARGETS zmq-shared
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
COMPONENT Runtime)
|
||||
endif ()
|
||||
else ()
|
||||
install (TARGETS libzmq libzmq-static
|
||||
install (TARGETS zmq-shared zmq-static
|
||||
EXPORT ${PROJECT_NAME}-targets
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
@ -138,7 +138,7 @@ if(WIN32)
|
||||
endif()
|
||||
|
||||
# add library and include dirs for all targets
|
||||
link_libraries(libzmq ${OPTIONAL_LIBRARIES})
|
||||
link_libraries(zmq-shared ${OPTIONAL_LIBRARIES})
|
||||
include_directories("${CMAKE_SOURCE_DIR}/../include")
|
||||
|
||||
foreach(test ${tests})
|
||||
|
Loading…
x
Reference in New Issue
Block a user