-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
29 lines (22 loc) · 1.04 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
cmake_minimum_required(VERSION 3.10)
project(AgarIO)
# Find SDL2 library
find_package(SDL2 REQUIRED CONFIG REQUIRED COMPONENTS SDL2)
find_package(SDL2 REQUIRED CONFIG COMPONENTS SDL2main)
include_directories(${SDL2_INCLUDE_DIRS})
# Set sources for client, server, and shared files
file(GLOB CLIENT_SOURCES client/*.c)
file(GLOB SERVER_SOURCES server/*.c)
file(GLOB SHARED_SOURCES shared/*.c)
# Client executable
add_executable(client ${CLIENT_SOURCES} ${SHARED_SOURCES})
# SDL2::SDL2main may or may not be available. It is e.g. required by Windows GUI applications
if(TARGET SDL2::SDL2main)
# It has an implicit dependency on SDL2 functions, so it MUST be added before SDL2::SDL2 (or SDL2::SDL2-static)
target_link_libraries(client PRIVATE SDL2::SDL2main)
endif()
# Link to the actual SDL2 library. SDL2::SDL2 is the shared SDL library, SDL2::SDL2-static is the static SDL libarary.
target_link_libraries(client PRIVATE SDL2::SDL2 m)
# Server executable
add_executable(server ${SERVER_SOURCES} ${SHARED_SOURCES})
target_link_libraries(server m)