-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
53 lines (42 loc) · 1.19 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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
cmake_minimum_required(VERSION 3.5)
project(SDL_TD VERSION 0.1 LANGUAGES CXX)
# Find SDL2
find_package(SDL2 REQUIRED)
find_package(SDL2_mixer REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_ttf REQUIRED)
# Set SDL include directories and libraries
set(SDL_INCLUDE_DIRS ${SDL2_INCLUDE_DIRS})
set(SDL_LIBRARIES ${SDL2_LIBRARIES})
# Find SDL2_mixer, SDL2_image, and SDL2_ttf
find_library(SDL_MIXER_LIBRARY NAMES SDL2_mixer)
find_library(SDL_IMAGE_LIBRARY NAMES SDL2_image)
find_library(SDL_TTF_LIBRARY NAMES SDL2_ttf)
include_directories(${SDL_INCLUDE_DIRS})
# Gather source and header files
file(GLOB_RECURSE PROJECT_SOURCES src/*.cpp)
file(GLOB_RECURSE PROJECT_HEADERS src/*.hpp)
# Create executable
add_executable(SDL_TD
${PROJECT_SOURCES}
${PROJECT_HEADERS}
)
# Link libraries
target_link_libraries(SDL_TD
${SDL_LIBRARIES}
${SDL_MIXER_LIBRARY}
${SDL_IMAGE_LIBRARY}
${SDL_TTF_LIBRARY}
fmt
)
file(GLOB ASSETS "assets/*")
foreach(ASSET ${ASSETS})
file(COPY ${ASSET} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/assets)
endforeach()
if(WIN32)
target_compile_definitions(SDL_TD PRIVATE
WIN32_LEAN_AND_MEAN
NOMINMAX
)
target_link_libraries(SDL_TD ws2_32)
endif()