mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-26 23:01:04 +08:00
Conform to cmakelint --filter=-linelength
- Lowercase all commands - Unify indent to 2 spaces - Remove spaces around brackets - Remove repitition of condition in else(...) and endif(...) Note: (re-)running CMake did not change the content of the generated files
This commit is contained in:
parent
ca7c03f825
commit
a21228b664
2126
CMakeLists.txt
2126
CMakeLists.txt
File diff suppressed because it is too large
Load Diff
@ -2,115 +2,117 @@
|
|||||||
cmake_minimum_required(VERSION "2.8.1")
|
cmake_minimum_required(VERSION "2.8.1")
|
||||||
|
|
||||||
# On Windows: solution file will be called tests.sln
|
# On Windows: solution file will be called tests.sln
|
||||||
PROJECT(tests)
|
project(tests)
|
||||||
|
|
||||||
set(tests
|
set(tests
|
||||||
test_ancillaries
|
test_ancillaries
|
||||||
test_system
|
test_system
|
||||||
test_pair_inproc
|
test_pair_inproc
|
||||||
test_pair_tcp
|
test_pair_tcp
|
||||||
test_reqrep_inproc
|
test_reqrep_inproc
|
||||||
test_reqrep_tcp
|
test_reqrep_tcp
|
||||||
test_hwm
|
test_hwm
|
||||||
test_hwm_pubsub
|
test_hwm_pubsub
|
||||||
test_reqrep_device
|
test_reqrep_device
|
||||||
test_sub_forward
|
test_sub_forward
|
||||||
test_invalid_rep
|
test_invalid_rep
|
||||||
test_msg_flags
|
test_msg_flags
|
||||||
test_msg_ffn
|
test_msg_ffn
|
||||||
test_connect_resolve
|
test_connect_resolve
|
||||||
test_immediate
|
test_immediate
|
||||||
test_last_endpoint
|
test_last_endpoint
|
||||||
test_term_endpoint
|
test_term_endpoint
|
||||||
test_router_mandatory
|
test_router_mandatory
|
||||||
test_probe_router
|
test_probe_router
|
||||||
test_stream
|
test_stream
|
||||||
test_stream_empty
|
test_stream_empty
|
||||||
test_stream_disconnect
|
test_stream_disconnect
|
||||||
test_disconnect_inproc
|
test_disconnect_inproc
|
||||||
test_unbind_wildcard
|
test_unbind_wildcard
|
||||||
test_ctx_options
|
test_ctx_options
|
||||||
test_ctx_destroy
|
test_ctx_destroy
|
||||||
test_security_null
|
test_security_null
|
||||||
test_security_plain
|
test_security_plain
|
||||||
test_security_zap
|
test_security_zap
|
||||||
test_iov
|
test_iov
|
||||||
test_spec_req
|
test_spec_req
|
||||||
test_spec_rep
|
test_spec_rep
|
||||||
test_spec_dealer
|
test_spec_dealer
|
||||||
test_spec_router
|
test_spec_router
|
||||||
test_spec_pushpull
|
test_spec_pushpull
|
||||||
test_req_correlate
|
test_req_correlate
|
||||||
test_req_relaxed
|
test_req_relaxed
|
||||||
test_conflate
|
test_conflate
|
||||||
test_inproc_connect
|
test_inproc_connect
|
||||||
test_issue_566
|
test_issue_566
|
||||||
test_shutdown_stress
|
test_shutdown_stress
|
||||||
test_timeo
|
test_timeo
|
||||||
test_many_sockets
|
test_many_sockets
|
||||||
test_diffserv
|
test_diffserv
|
||||||
test_connect_rid
|
test_connect_rid
|
||||||
test_xpub_nodrop
|
test_xpub_nodrop
|
||||||
test_pub_invert_matching
|
test_pub_invert_matching
|
||||||
test_setsockopt
|
test_setsockopt
|
||||||
test_sockopt_hwm
|
test_sockopt_hwm
|
||||||
test_heartbeats
|
test_heartbeats
|
||||||
test_atomics
|
test_atomics
|
||||||
test_bind_src_address
|
test_bind_src_address
|
||||||
test_capabilities
|
test_capabilities
|
||||||
test_metadata
|
test_metadata
|
||||||
test_router_handover
|
test_router_handover
|
||||||
test_srcfd
|
test_srcfd
|
||||||
test_stream_timeout
|
test_stream_timeout
|
||||||
test_xpub_manual
|
test_xpub_manual
|
||||||
test_xpub_welcome_msg
|
test_xpub_welcome_msg
|
||||||
test_xpub_verbose
|
test_xpub_verbose
|
||||||
test_base85
|
test_base85
|
||||||
test_bind_after_connect_tcp
|
test_bind_after_connect_tcp
|
||||||
test_sodium
|
test_sodium
|
||||||
test_monitor
|
test_monitor
|
||||||
test_socket_null
|
test_socket_null
|
||||||
test_reconnect_ivl
|
test_reconnect_ivl
|
||||||
test_mock_pub_sub
|
test_mock_pub_sub
|
||||||
)
|
)
|
||||||
|
|
||||||
if(ZMQ_HAVE_CURVE)
|
if(ZMQ_HAVE_CURVE)
|
||||||
list(APPEND tests
|
list(APPEND tests
|
||||||
test_security_curve)
|
test_security_curve)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
list(APPEND tests
|
list(APPEND tests
|
||||||
test_ipc_wildcard
|
test_ipc_wildcard
|
||||||
test_pair_ipc
|
test_pair_ipc
|
||||||
test_rebind_ipc
|
test_rebind_ipc
|
||||||
test_reqrep_ipc
|
test_reqrep_ipc
|
||||||
test_proxy
|
test_proxy
|
||||||
test_proxy_single_socket
|
test_proxy_single_socket
|
||||||
test_proxy_terminate
|
test_proxy_terminate
|
||||||
test_getsockopt_memset
|
test_getsockopt_memset
|
||||||
test_filter_ipc
|
test_filter_ipc
|
||||||
test_stream_exceeds_buffer
|
test_stream_exceeds_buffer
|
||||||
test_router_mandatory_hwm
|
test_router_mandatory_hwm
|
||||||
test_use_fd
|
test_use_fd
|
||||||
test_zmq_poll_fd
|
test_zmq_poll_fd
|
||||||
)
|
)
|
||||||
if(HAVE_FORK)
|
if(HAVE_FORK)
|
||||||
list(APPEND tests test_fork)
|
list(APPEND tests test_fork)
|
||||||
endif()
|
endif()
|
||||||
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
|
||||||
list(APPEND tests
|
list(APPEND tests
|
||||||
test_abstract_ipc
|
test_abstract_ipc
|
||||||
)
|
)
|
||||||
if(ZMQ_HAVE_TIPC)
|
if(ZMQ_HAVE_TIPC)
|
||||||
list(APPEND tests
|
list(APPEND tests
|
||||||
test_address_tipc
|
test_address_tipc
|
||||||
test_pair_tipc
|
test_pair_tipc
|
||||||
test_reqrep_device_tipc
|
test_reqrep_device_tipc
|
||||||
test_reqrep_tipc
|
test_reqrep_tipc
|
||||||
test_router_mandatory_tipc
|
test_router_mandatory_tipc
|
||||||
test_sub_forward_tipc
|
test_sub_forward_tipc
|
||||||
test_connect_delay_tipc
|
test_connect_delay_tipc
|
||||||
test_shutdown_stress_tipc
|
test_shutdown_stress_tipc
|
||||||
test_term_endpoint_tipc
|
test_term_endpoint_tipc
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
@ -118,92 +120,89 @@ endif()
|
|||||||
|
|
||||||
if(WITH_VMCI)
|
if(WITH_VMCI)
|
||||||
list(APPEND tests
|
list(APPEND tests
|
||||||
test_pair_vmci
|
test_pair_vmci
|
||||||
test_reqrep_vmci
|
test_reqrep_vmci
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_DRAFTS)
|
||||||
IF (ENABLE_DRAFTS)
|
list(APPEND tests
|
||||||
list(APPEND tests
|
test_poller
|
||||||
test_poller
|
test_thread_safe
|
||||||
test_thread_safe
|
test_client_server
|
||||||
test_client_server
|
test_timers
|
||||||
test_timers
|
test_radio_dish
|
||||||
test_radio_dish
|
test_scatter_gather
|
||||||
test_scatter_gather
|
test_dgram
|
||||||
test_dgram
|
test_app_meta
|
||||||
test_app_meta
|
test_router_notify
|
||||||
test_router_notify
|
)
|
||||||
)
|
endif()
|
||||||
ENDIF (ENABLE_DRAFTS)
|
|
||||||
|
|
||||||
# add location of platform.hpp for Windows builds
|
# add location of platform.hpp for Windows builds
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
||||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||||
# Same name on 64bit systems
|
# Same name on 64bit systems
|
||||||
link_libraries(ws2_32.lib)
|
link_libraries(ws2_32.lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library (unity
|
add_library(unity STATIC
|
||||||
STATIC
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c"
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h"
|
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity_internals.h")
|
set_target_properties(unity PROPERTIES
|
||||||
set_target_properties (unity PROPERTIES
|
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
|
||||||
PUBLIC_HEADER "${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.h")
|
target_compile_definitions(unity PUBLIC "UNITY_USE_COMMAND_LINE_ARGS" "UNITY_EXCLUDE_FLOAT")
|
||||||
target_compile_definitions (unity PUBLIC "UNITY_USE_COMMAND_LINE_ARGS" "UNITY_EXCLUDE_FLOAT")
|
target_include_directories(unity PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
|
||||||
target_include_directories (unity PUBLIC "${CMAKE_CURRENT_LIST_DIR}/../external/unity")
|
|
||||||
|
|
||||||
IF (MSVC_VERSION LESS 1700)
|
if(MSVC_VERSION LESS 1700)
|
||||||
SET_SOURCE_FILES_PROPERTIES("${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c" PROPERTIES LANGUAGE CXX)
|
set_source_files_properties("${CMAKE_CURRENT_LIST_DIR}/../external/unity/unity.c" PROPERTIES LANGUAGE CXX)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF (MSVC_VERSION LESS 1600)
|
if(MSVC_VERSION LESS 1600)
|
||||||
target_compile_definitions (unity PUBLIC "UNITY_EXCLUDE_STDINT_H")
|
target_compile_definitions(unity PUBLIC "UNITY_EXCLUDE_STDINT_H")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
# add library and include dirs for all targets
|
# add library and include dirs for all targets
|
||||||
if (BUILD_SHARED)
|
if(BUILD_SHARED)
|
||||||
link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
link_libraries(libzmq ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||||
else ()
|
else()
|
||||||
link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
link_libraries(libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||||
endif ()
|
endif()
|
||||||
include_directories("${ZeroMQ_SOURCE_DIR}/../include" "${ZeroMQ_BINARY_DIR}")
|
include_directories("${ZeroMQ_SOURCE_DIR}/../include" "${ZeroMQ_BINARY_DIR}")
|
||||||
|
|
||||||
foreach(test ${tests})
|
foreach(test ${tests})
|
||||||
# target_sources not supported before CMake 3.1
|
# target_sources not supported before CMake 3.1
|
||||||
if (ZMQ_HAVE_CURVE AND ${test} MATCHES test_security_curve)
|
if(ZMQ_HAVE_CURVE AND ${test} MATCHES test_security_curve)
|
||||||
add_executable(${test} ${test}.cpp
|
add_executable(${test} ${test}.cpp
|
||||||
"../src/tweetnacl.c"
|
"../src/tweetnacl.c"
|
||||||
"../src/err.cpp"
|
"../src/err.cpp"
|
||||||
"../src/random.cpp"
|
"../src/random.cpp"
|
||||||
"../src/clock.cpp"
|
"../src/clock.cpp"
|
||||||
"testutil_security.hpp")
|
"testutil_security.hpp")
|
||||||
elseif (${test} MATCHES test_security_zap)
|
elseif(${test} MATCHES test_security_zap)
|
||||||
add_executable(${test} ${test}.cpp
|
add_executable(${test} ${test}.cpp
|
||||||
"testutil_security.hpp")
|
"testutil_security.hpp")
|
||||||
else ()
|
else()
|
||||||
add_executable(${test} ${test}.cpp "testutil.hpp" "testutil_unity.hpp")
|
add_executable(${test} ${test}.cpp "testutil.hpp" "testutil_unity.hpp")
|
||||||
endif ()
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
# This is the output for Debug dynamic builds on Visual Studio 6.0
|
# This is the output for Debug dynamic builds on Visual Studio 6.0
|
||||||
# You should provide the correct directory, don't know how to do it automatically
|
# You should provide the correct directory, don't know how to do it automatically
|
||||||
find_path(LIBZMQ_PATH "libzmq.lib" PATHS "../bin/Win32/Debug/v120/dynamic")
|
find_path(LIBZMQ_PATH "libzmq.lib" PATHS "../bin/Win32/Debug/v120/dynamic")
|
||||||
if(NOT ${LIBZMQ_PATH} STREQUAL "LIBZMQ_PATH-NOTFOUND")
|
if(NOT ${LIBZMQ_PATH} STREQUAL "LIBZMQ_PATH-NOTFOUND")
|
||||||
SET_TARGET_PROPERTIES( ${test} PROPERTIES LINK_FLAGS "/LIBPATH:${LIBZMQ_PATH}" )
|
set_target_properties(${test} PROPERTIES LINK_FLAGS "/LIBPATH:${LIBZMQ_PATH}")
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
# per-test directories not generated on OS X / Darwin
|
# per-test directories not generated on OS X / Darwin
|
||||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
||||||
link_directories(${test} PRIVATE "${ZeroMQ_SOURCE_DIR}/../lib")
|
link_directories(${test} PRIVATE "${ZeroMQ_SOURCE_DIR}/../lib")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if(RT_LIBRARY)
|
if(RT_LIBRARY)
|
||||||
target_link_libraries(${test} ${RT_LIBRARY} )
|
target_link_libraries(${test} ${RT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
add_test(NAME ${test} WORKING_DIRECTORY ${LIBRARY_OUTPUT_PATH} COMMAND ${test})
|
||||||
@ -242,7 +241,7 @@ file(GLOB ALL_TEST_SOURCES "test_*.cpp")
|
|||||||
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
||||||
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
||||||
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
||||||
if (NOT MATCH_TESTNAME)
|
if(NOT MATCH_TESTNAME)
|
||||||
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -9,17 +9,17 @@ set(unittests
|
|||||||
unittest_udp_address
|
unittest_udp_address
|
||||||
)
|
)
|
||||||
|
|
||||||
#IF (ENABLE_DRAFTS)
|
#if(ENABLE_DRAFTS)
|
||||||
# list(APPEND tests
|
# list(APPEND tests
|
||||||
# )
|
# )
|
||||||
#ENDIF (ENABLE_DRAFTS)
|
#endif(ENABLE_DRAFTS)
|
||||||
|
|
||||||
# add location of platform.hpp for Windows builds
|
# add location of platform.hpp for Windows builds
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
add_definitions(-DZMQ_CUSTOM_PLATFORM_HPP)
|
||||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||||
# Same name on 64bit systems
|
# Same name on 64bit systems
|
||||||
link_libraries(ws2_32.lib)
|
link_libraries(ws2_32.lib)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories("${ZeroMQ_SOURCE_DIR}/include" "${ZeroMQ_SOURCE_DIR}/src" "${ZeroMQ_BINARY_DIR}")
|
include_directories("${ZeroMQ_SOURCE_DIR}/include" "${ZeroMQ_SOURCE_DIR}/src" "${ZeroMQ_BINARY_DIR}")
|
||||||
@ -30,24 +30,24 @@ foreach(test ${unittests})
|
|||||||
add_executable(${test} ${test}.cpp "unittest_resolver_common.hpp")
|
add_executable(${test} ${test}.cpp "unittest_resolver_common.hpp")
|
||||||
|
|
||||||
# per-test directories not generated on OS X / Darwin
|
# per-test directories not generated on OS X / Darwin
|
||||||
if (NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
if(NOT ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang.*")
|
||||||
link_directories(${test} PRIVATE "${ZeroMQ_SOURCE_DIR}/../lib")
|
link_directories(${test} PRIVATE "${ZeroMQ_SOURCE_DIR}/../lib")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
target_link_libraries(${test} libzmq-static ${OPTIONAL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} unity)
|
||||||
|
|
||||||
if(RT_LIBRARY)
|
if(RT_LIBRARY)
|
||||||
target_link_libraries(${test} ${RT_LIBRARY})
|
target_link_libraries(${test} ${RT_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
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()
|
||||||
|
|
||||||
set_tests_properties(${test} PROPERTIES TIMEOUT 10)
|
set_tests_properties(${test} PROPERTIES TIMEOUT 10)
|
||||||
|
|
||||||
# TODO prevent libzmq (non-static) being in the list of link libraries at all
|
# TODO prevent libzmq (non-static) being in the list of link libraries at all
|
||||||
get_target_property(LIBS ${test} LINK_LIBRARIES)
|
get_target_property(LIBS ${test} LINK_LIBRARIES)
|
||||||
list(REMOVE_ITEM LIBS libzmq)
|
list(REMOVE_ITEM LIBS libzmq)
|
||||||
@ -61,7 +61,7 @@ file(GLOB ALL_TEST_SOURCES "test_*.cpp")
|
|||||||
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
foreach(TEST_SOURCE ${ALL_TEST_SOURCES})
|
||||||
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
get_filename_component(TESTNAME "${TEST_SOURCE}" NAME_WE)
|
||||||
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
string(REGEX MATCH "${TESTNAME}" MATCH_TESTNAME "${CURRENT_LIST_FILE_CONTENT}")
|
||||||
if (NOT MATCH_TESTNAME)
|
if(NOT MATCH_TESTNAME)
|
||||||
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
message(AUTHOR_WARNING "Test '${TESTNAME}' is not known to CTest.")
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user