mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-21 23:19:31 +08:00
Add static compilation on CMake
This commit is contained in:
parent
678ad54a12
commit
bc7b0fd383
@ -522,6 +522,11 @@ else()
|
|||||||
OUTPUT_NAME "zmq"
|
OUTPUT_NAME "zmq"
|
||||||
PUBLIC_HEADER "${public_headers}")
|
PUBLIC_HEADER "${public_headers}")
|
||||||
endif()
|
endif()
|
||||||
|
add_library(libzmq-static STATIC ${sources} ${public_headers} ${html-docs} ${readme-docs} ${zmq-pkgconfig})
|
||||||
|
set_target_properties(libzmq-static PROPERTIES
|
||||||
|
PUBLIC_HEADER "${public_headers}"
|
||||||
|
COMPILE_FLAGS "-DZMQ_STATIC"
|
||||||
|
OUTPUT_NAME "zmq-static")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(libzmq ${CMAKE_THREAD_LIBS_INIT})
|
||||||
@ -573,7 +578,7 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
set(tests
|
set(tests
|
||||||
test_system
|
test_system
|
||||||
test_immediate
|
test_immediate
|
||||||
test_connect_resolve
|
test_connect_resolve
|
||||||
@ -616,7 +621,7 @@ list(APPEND tests
|
|||||||
test_pair_ipc
|
test_pair_ipc
|
||||||
test_reqrep_ipc
|
test_reqrep_ipc
|
||||||
test_stream)
|
test_stream)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
foreach(test ${tests})
|
foreach(test ${tests})
|
||||||
add_executable(${test} tests/${test}.cpp)
|
add_executable(${test} tests/${test}.cpp)
|
||||||
@ -629,7 +634,7 @@ foreach(test ${tests})
|
|||||||
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
||||||
else()
|
else()
|
||||||
add_test(NAME ${test} COMMAND ${test})
|
add_test(NAME ${test} COMMAND ${test})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
#-----------------------------------------------------------------------------
|
#-----------------------------------------------------------------------------
|
||||||
@ -655,7 +660,7 @@ if(MSVC)
|
|||||||
COMPONENT Runtime)
|
COMPONENT Runtime)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
install(TARGETS libzmq
|
install(TARGETS libzmq libzmq-static
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
ARCHIVE DESTINATION lib
|
ARCHIVE DESTINATION lib
|
||||||
LIBRARY DESTINATION lib
|
LIBRARY DESTINATION lib
|
||||||
|
Loading…
x
Reference in New Issue
Block a user