44 lines
1.5 KiB
CMake
44 lines
1.5 KiB
CMake
### 1. CLion needs a recipe to know how to build your code.
|
|
## This file tells CLion: "Hey, make a program called iovi_network using main.cpp.
|
|
## And make sure we are allowed to use multiple threads (helpers),
|
|
## and also if we are on Windows, turn on the Windows networking plug."
|
|
|
|
# EchoProject/
|
|
# ├── CMakeLists.txt (The updated recipe)
|
|
# ├── NetworkConfig.h (The universal translator rules)
|
|
# ├── EchoServer.h (The Server Menu)
|
|
# ├── EchoServer.cpp (The Server Kitchen)
|
|
# ├── EchoClient.h (The Client Menu)
|
|
# ├── EchoClient.cpp (The Client Kitchen)
|
|
# └── main.cpp (The boss who tells everyone what to do)
|
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
project(iovi_network)
|
|
|
|
# Tell C++ to use modern features (C++17)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Find the threading library (needed for our "async" cloning magic)
|
|
find_package(Threads REQUIRED)
|
|
|
|
# Create our single program from the list of files
|
|
add_executable(iovi_network
|
|
main.cpp
|
|
NetworkConfig.h
|
|
EchoServer.cpp
|
|
EchoServer.h
|
|
SimpleClient.cpp
|
|
SimpleClient.h
|
|
server/ServerSocketThread.cpp
|
|
server/ServerSocketThread.h
|
|
)
|
|
|
|
# Link the threading library
|
|
target_link_libraries(iovi_network PRIVATE Threads::Threads)
|
|
|
|
# If we are on Windows, we need to link the Windows Socket library (ws2_32)
|
|
if(WIN32)
|
|
target_link_libraries(iovi_network PRIVATE ws2_32)
|
|
endif()
|