-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
50 lines (36 loc) · 1.28 KB
/
CMakeLists.txt
File metadata and controls
50 lines (36 loc) · 1.28 KB
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
cmake_minimum_required(VERSION 3.23)
project(SDL_components
VERSION 1.0.0
DESCRIPTION "Components for SDL"
LANGUAGES CXX
)
# Build Option
set(DEBUG_FILE_OPTION FALSE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_lib/sdl2)
add_compile_options(-Wall -std=c++17)
include_directories(./includes)
file(GLOB_RECURSE SRCS "./src/**.cpp")
if (NOT DEBUG_FILE_OPTION)
list(FILTER SRCS EXCLUDE REGEX ".*main.cpp")
endif()
if (DEBUG_FILE_OPTION)
add_executable(SDL_components ${SRCS})
add_executable(DEBUG ${SRCS})
endif()
add_library(components ${SRCS})
if (DEBUG_FILE_OPTION)
target_compile_options(DEBUG PUBLIC -g -DDEBUG)
endif()
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
find_package(SDL2_gfx REQUIRED)
include_directories(${SDL2_GFX_INCLUDE_DIRS})
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_TTF_INCLUDE_DIRS})
if (DEBUG_FILE_OPTION)
target_link_libraries(SDL_components ${SDL2_LIBRARIES} ${SDL2_GFX_LIBRARIES} ${SDL2_TTF_LIBRARIES})
target_link_libraries(DEBUG ${SDL2_LIBRARIES} ${SDL2_GFX_LIBRARIES} ${SDL2_TTF_LIBRARIES})
endif()
target_link_libraries(components PUBLIC ${SDL2_LIBRARIES} ${SDL2_GFX_LIBRARIES} ${SDL2_TTF_LIBRARIES})
add_subdirectory(./examples)