mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-14 01:37:56 +08:00
Fix MinGW32 build
Fix link errors when using -m32 with MinGW
This commit is contained in:
parent
3c7d4840a1
commit
59cafecd96
@ -46,14 +46,17 @@ check_include_files(windows.h HAVE_WINDOWS_H)
|
|||||||
check_include_files(sys/uio.h ZMQ_HAVE_UIO)
|
check_include_files(sys/uio.h ZMQ_HAVE_UIO)
|
||||||
check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD)
|
check_include_files(sys/eventfd.h ZMQ_HAVE_EVENTFD)
|
||||||
|
|
||||||
check_library_exists(ws2_32 WSAStartup "" HAVE_WS2_32)
|
check_library_exists(ws2_32 printf "" HAVE_WS2_32) # TODO: Why doesn't something logical like WSAStartup work?
|
||||||
check_library_exists(rpcrt4 UuidCreateSequential "" HAVE_RPCRT4)
|
check_library_exists(ws2 printf "" HAVE_WS2)
|
||||||
check_library_exists(iphlpapi GetAdaptersAddresses "" HAVE_IPHLAPI)
|
check_library_exists(rpcrt4 printf "" HAVE_RPCRT4) # UuidCreateSequential
|
||||||
|
check_library_exists(iphlpapi printf "" HAVE_IPHLAPI) # GetAdaptersAddresses
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
if(MINGW)
|
|
||||||
if(NOT HAVE_WS2_32)
|
if(WIN32 AND NOT CYGWIN)
|
||||||
message(FATAL_ERROR "Cannot link to ws2_32")
|
if(NOT HAVE_WS2_32 AND NOT HAVE_WS2)
|
||||||
|
message(FATAL_ERROR "Cannot link to ws2_32 or ws2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT HAVE_RPCRT4)
|
if(NOT HAVE_RPCRT4)
|
||||||
@ -216,9 +219,6 @@ else()
|
|||||||
if(WITH_OPENPGM)
|
if(WITH_OPENPGM)
|
||||||
message(FATAL_ERROR "WITH_OPENPGM not implemented")
|
message(FATAL_ERROR "WITH_OPENPGM not implemented")
|
||||||
# DSO symbol visibility for openpgm
|
# DSO symbol visibility for openpgm
|
||||||
check_c_compiler_flag("-fvisibility=hidden" HAVE_FLAG_VISIBILITY_HIDDEN)
|
|
||||||
check_c_compiler_flag("-xldscope=hidden" HAVE_FLAG_LDSCOPE_HIDDEN)
|
|
||||||
|
|
||||||
if(HAVE_FLAG_VISIBILITY_HIDDEN)
|
if(HAVE_FLAG_VISIBILITY_HIDDEN)
|
||||||
|
|
||||||
elseif(HAVE_FLAG_LDSCOPE_HIDDEN)
|
elseif(HAVE_FLAG_LDSCOPE_HIDDEN)
|
||||||
@ -259,11 +259,10 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/lib)
|
|||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_definitions(
|
add_definitions(
|
||||||
-DWIN32
|
-DWIN32
|
||||||
-DDLL_EXPORT
|
-DDLL_EXPORT
|
||||||
# NB: May require tweaking for highly connected applications.
|
# NB: May require tweaking for highly connected applications.
|
||||||
-DFD_SETSIZE=1024
|
-DFD_SETSIZE=1024
|
||||||
-D_CRT_SECURE_NO_WARNINGS
|
-D_CRT_SECURE_NO_WARNINGS)
|
||||||
)
|
|
||||||
|
|
||||||
# Parallel make.
|
# Parallel make.
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||||
@ -342,30 +341,46 @@ set(cxx-sources
|
|||||||
xpub.cpp
|
xpub.cpp
|
||||||
xsub.cpp
|
xsub.cpp
|
||||||
zmq.cpp
|
zmq.cpp
|
||||||
zmq_utils.cpp
|
zmq_utils.cpp)
|
||||||
)
|
|
||||||
|
|
||||||
set(rc-sources
|
set(rc-sources version.rc)
|
||||||
version.rc
|
|
||||||
)
|
|
||||||
|
|
||||||
include_directories(
|
if(MINGW)
|
||||||
include
|
# Generate the right type when using -m32 or -m64
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
macro(set_rc_arch rc_target)
|
||||||
)
|
set(CMAKE_RC_COMPILER_INIT windres)
|
||||||
set(public_headers
|
enable_language(RC)
|
||||||
include/zmq.h
|
set(CMAKE_RC_COMPILE_OBJECT
|
||||||
include/zmq_utils.h
|
"<CMAKE_RC_COMPILER> <FLAGS> --target=${rc_target} <DEFINES> -i <SOURCE> -o <OBJECT>")
|
||||||
)
|
endmacro()
|
||||||
|
|
||||||
set(readme-docs
|
if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i386"
|
||||||
AUTHORS
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i486"
|
||||||
COPYING
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i586"
|
||||||
COPYING.LESSER
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "i686"
|
||||||
MAINTAINERS
|
# This also happens on x86_64 systems...what a worthless variable
|
||||||
NEWS
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86"
|
||||||
README
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64"
|
||||||
)
|
OR ${CMAKE_SYSTEM_PROCESSOR} MATCHES "amd64")
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set_rc_arch("pe-x86-64")
|
||||||
|
else()
|
||||||
|
set_rc_arch("pe-i386")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include_directories(include ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
set(public_headers include/zmq.h
|
||||||
|
include/zmq_utils.h)
|
||||||
|
|
||||||
|
set(readme-docs AUTHORS
|
||||||
|
COPYING
|
||||||
|
COPYING.LESSER
|
||||||
|
MAINTAINERS
|
||||||
|
NEWS
|
||||||
|
README)
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
# optional modules
|
# optional modules
|
||||||
@ -504,6 +519,8 @@ endif()
|
|||||||
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
|
||||||
if(HAVE_WS2_32)
|
if(HAVE_WS2_32)
|
||||||
target_link_libraries(libzmq ws2_32)
|
target_link_libraries(libzmq ws2_32)
|
||||||
|
elseif(HAVE_WS2)
|
||||||
|
target_link_libraries(libzmq ws2)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_RPCRT4)
|
if(HAVE_RPCRT4)
|
||||||
@ -563,7 +580,7 @@ if(MSVC)
|
|||||||
else()
|
else()
|
||||||
install(TARGETS libzmq
|
install(TARGETS libzmq
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
#PUBLIC_HEADER DESTINATION include
|
PUBLIC_HEADER DESTINATION include
|
||||||
COMPONENT Runtime)
|
COMPONENT Runtime)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
|
@ -42,6 +42,10 @@
|
|||||||
#define ZMQ_HAVE_CYGWIN
|
#define ZMQ_HAVE_CYGWIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined __MINGW32__
|
||||||
|
#define ZMQ_HAVE_MINGW32
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__)
|
||||||
#define ZMQ_HAVE_FREEBSD
|
#define ZMQ_HAVE_FREEBSD
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user