0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-14 09:47:56 +08:00

Added ZMQ_BUILD_TESTS to CMakeLists.txt to allow turning off tests. Useful when building ZMQ as a git submodule.

This commit is contained in:
Gyula Laszlo 2014-02-07 17:50:45 +01:00
parent 5a47fc4f08
commit 7a86b39d63

View File

@ -580,8 +580,14 @@ if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") # Why?
endforeach() endforeach()
endif() endif()
enable_testing() #-----------------------------------------------------------------------------
set(tests # tests
set(ZMQ_BUILD_TESTS ON CACHE BOOL "Build the tests for ZeroMQ")
if(ZMQ_BUILD_TESTS)
enable_testing()
set(tests
test_system test_system
test_pair_inproc test_pair_inproc
test_pair_tcp test_pair_tcp
@ -623,9 +629,9 @@ set(tests
test_many_sockets test_many_sockets
test_diffserv test_diffserv
test_connect_rid test_connect_rid
) )
if(NOT WIN32) if(NOT WIN32)
list(APPEND tests list(APPEND tests
test_monitor test_monitor
test_pair_ipc test_pair_ipc
test_reqrep_ipc test_reqrep_ipc
@ -633,10 +639,10 @@ list(APPEND tests
test_abstract_ipc test_abstract_ipc
test_proxy test_proxy
test_filter_ipc test_filter_ipc
) )
endif() endif()
foreach(test ${tests}) foreach(test ${tests})
add_executable(${test} tests/${test}.cpp) add_executable(${test} tests/${test}.cpp)
target_link_libraries(${test} libzmq) target_link_libraries(${test} libzmq)
@ -648,13 +654,15 @@ foreach(test ${tests})
else() else()
add_test(NAME ${test} COMMAND ${test}) add_test(NAME ${test} COMMAND ${test})
endif() endif()
endforeach() endforeach()
if(NOT WIN32) if(NOT WIN32)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux") if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux")
set_tests_properties(test_abstract_ipc PROPERTIES WILL_FAIL true) set_tests_properties(test_abstract_ipc PROPERTIES WILL_FAIL true)
endif() endif()
endif() endif()
endif() # ZMQ_BUILD_TESTS
#----------------------------------------------------------------------------- #-----------------------------------------------------------------------------
# installer # installer