IXWebSocket/test/CMakeLists.txt

58 lines
1.4 KiB
CMake
Raw Normal View History

2018-12-29 18:33:15 -08:00
#
# Author: Benjamin Sergeant
# Copyright (c) 2018 Machine Zone, Inc. All rights reserved.
#
2019-01-07 18:04:28 -08:00
cmake_minimum_required (VERSION 3.4.1)
project (ixwebsocket_unittest)
2018-12-29 18:33:15 -08:00
2019-01-06 18:54:16 -08:00
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/../third_party/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
find_package(Sanitizers)
set (CMAKE_CXX_STANDARD 14)
2018-12-29 18:33:15 -08:00
2019-01-04 17:28:13 -08:00
if (NOT WIN32)
2019-05-06 19:13:42 +03:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
set(CMAKE_LD_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
2019-01-04 17:28:13 -08:00
option(USE_TLS "Add TLS support" ON)
endif()
2018-12-29 18:33:15 -08:00
add_subdirectory(${PROJECT_SOURCE_DIR}/.. ixwebsocket)
include_directories(
${PROJECT_SOURCE_DIR}/Catch2/single_include
../third_party/msgpack11
2018-12-29 18:33:15 -08:00
)
2019-01-05 14:40:17 -08:00
# Shared sources
set (SOURCES
2018-12-29 18:33:15 -08:00
test_runner.cpp
IXTest.cpp
../third_party/msgpack11/msgpack11.cpp
2019-01-05 17:02:39 -08:00
IXDNSLookupTest.cpp
IXSocketTest.cpp
2019-03-21 10:06:59 -07:00
IXSocketConnectTest.cpp
IXWebSocketServerTest.cpp
IXWebSocketPingTest.cpp
IXWebSocketTestConnectionDisconnection.cpp
IXUrlParserTest.cpp
2018-12-29 18:33:15 -08:00
)
2019-01-05 14:40:17 -08:00
# Some unittest don't work on windows yet
if (NOT WIN32)
list(APPEND SOURCES
IXWebSocketPingTimeoutTest.cpp
2019-01-05 14:40:17 -08:00
cmd_websocket_chat.cpp
)
endif()
add_executable(ixwebsocket_unittest ${SOURCES})
2019-01-06 18:54:16 -08:00
add_sanitizers(ixwebsocket_unittest)
2019-01-05 14:40:17 -08:00
2018-12-29 18:33:15 -08: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)