2018-12-30 03:33:15 +01:00
|
|
|
#
|
|
|
|
# Author: Benjamin Sergeant
|
|
|
|
# Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
|
|
|
|
#
|
2019-01-08 03:04:28 +01:00
|
|
|
cmake_minimum_required (VERSION 3.4.1)
|
|
|
|
project (ixwebsocket_unittest)
|
2018-12-30 03:33:15 +01:00
|
|
|
|
2019-01-07 03:54:16 +01:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../third_party/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
|
|
|
|
find_package(Sanitizers)
|
|
|
|
|
2019-01-12 06:25:06 +01:00
|
|
|
set (CMAKE_CXX_STANDARD 14)
|
2018-12-30 03:33:15 +01:00
|
|
|
|
2019-01-05 02:28:13 +01:00
|
|
|
if (NOT WIN32)
|
|
|
|
option(USE_TLS "Add TLS support" ON)
|
|
|
|
endif()
|
2018-12-30 03:33:15 +01:00
|
|
|
|
|
|
|
add_subdirectory(${PROJECT_SOURCE_DIR}/.. ixwebsocket)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${PROJECT_SOURCE_DIR}/Catch2/single_include
|
2019-02-22 06:24:53 +01:00
|
|
|
../third_party/msgpack11
|
2018-12-30 03:33:15 +01:00
|
|
|
)
|
|
|
|
|
2019-01-05 23:40:17 +01:00
|
|
|
# Shared sources
|
|
|
|
set (SOURCES
|
2018-12-30 03:33:15 +01:00
|
|
|
test_runner.cpp
|
|
|
|
IXTest.cpp
|
2019-02-22 06:24:53 +01:00
|
|
|
../third_party/msgpack11/msgpack11.cpp
|
2019-01-06 02:02:39 +01:00
|
|
|
|
|
|
|
IXDNSLookupTest.cpp
|
|
|
|
IXSocketTest.cpp
|
2018-12-30 03:33:15 +01:00
|
|
|
)
|
|
|
|
|
2019-01-05 23:40:17 +01:00
|
|
|
# Some unittest don't work on windows yet
|
|
|
|
if (NOT WIN32)
|
|
|
|
list(APPEND SOURCES
|
|
|
|
IXWebSocketServerTest.cpp
|
2019-01-25 03:50:07 +01:00
|
|
|
IXWebSocketHeartBeatTest.cpp
|
2019-01-05 23:40:17 +01:00
|
|
|
cmd_websocket_chat.cpp
|
2019-01-07 00:14:13 +01:00
|
|
|
IXWebSocketTestConnectionDisconnection.cpp
|
2019-01-05 23:40:17 +01:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(ixwebsocket_unittest ${SOURCES})
|
2019-01-07 03:54:16 +01:00
|
|
|
add_sanitizers(ixwebsocket_unittest)
|
2019-01-05 23:40:17 +01:00
|
|
|
|
2018-12-30 03:33:15 +01:00
|
|
|
if (APPLE AND USE_TLS)
|
|
|
|
target_link_libraries(ixwebsocket_unittest "-framework foundation" "-framework security")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_link_libraries(ixwebsocket_unittest ixwebsocket)
|
|
|
|
install(TARGETS ixwebsocket_unittest DESTINATION bin)
|