summaryrefslogtreecommitdiffstats
path: root/tests/Network/CMakeLists.txt
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2015-01-25 00:34:19 +0100
committerHowaner <franzi.moos@googlemail.com>2015-01-25 00:34:19 +0100
commit1eedccc56a1a80b42adbea8dbbe968d42c7fe712 (patch)
treea5fe3fb72a3c3918b2c4ba413c686f718f5d403c /tests/Network/CMakeLists.txt
parentC++11 and function rename. (diff)
parentGamosocm support (diff)
downloadcuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar.gz
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar.bz2
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar.lz
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar.xz
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.tar.zst
cuberite-1eedccc56a1a80b42adbea8dbbe968d42c7fe712.zip
Diffstat (limited to 'tests/Network/CMakeLists.txt')
-rw-r--r--tests/Network/CMakeLists.txt60
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/Network/CMakeLists.txt b/tests/Network/CMakeLists.txt
new file mode 100644
index 000000000..c0af50e2c
--- /dev/null
+++ b/tests/Network/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required (VERSION 2.6)
+
+enable_testing()
+
+include_directories(${CMAKE_SOURCE_DIR}/src/)
+include_directories(${CMAKE_SOURCE_DIR}/lib/libevent/include)
+
+add_definitions(-DTEST_GLOBALS=1)
+
+# Create a single Network library that contains all the networking code:
+set (Network_SRCS
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/HostnameLookup.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/IPLookup.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/NetworkSingleton.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/ServerHandleImpl.cpp
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/TCPLinkImpl.cpp
+ ${CMAKE_SOURCE_DIR}/src/StringUtils.cpp
+)
+
+set (Network_HDRS
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/CriticalSection.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/Event.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/HostnameLookup.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/IPLookup.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/Network.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/NetworkSingleton.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/ServerHandleImpl.h
+ ${CMAKE_SOURCE_DIR}/src/OSSupport/TCPLinkImpl.h
+ ${CMAKE_SOURCE_DIR}/src/StringUtils.h
+)
+
+add_library(Network
+ ${Network_SRCS}
+ ${Network_HDRS}
+)
+
+target_link_libraries(Network event_core event_extra)
+if (MSVC)
+ target_link_libraries(Network ws2_32.lib)
+endif()
+
+
+
+
+# Define individual tests:
+
+# Google: download the google.com frontpage using http client socket:
+add_executable(Google-exe Google.cpp)
+target_link_libraries(Google-exe Network)
+add_test(NAME Google-test COMMAND Google-exe)
+
+# EchoServer: Listen on port 9876, echo everything back:
+add_executable(EchoServer EchoServer.cpp)
+target_link_libraries(EchoServer Network)
+
+# NameLookup: Lookup hostname-to-IP and IP-to-hostname:
+add_executable(NameLookup NameLookup.cpp)
+target_link_libraries(NameLookup Network)