forked from udacity/CppND-Capstone-Snake-Game
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
34 lines (25 loc) · 865 Bytes
/
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
cmake_minimum_required(VERSION 3.7)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-std=c++17)
set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")
project(SDL2Test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(SDL2 REQUIRED)
find_library(SDL2_TTF_LIBRARY
NAMES SDL2_ttf
PATHS /usr/lib /usr/local/lib
REQUIRED
)
# Check if SDL2_ttf library is found
if(SDL2_TTF_LIBRARY)
message(STATUS "SDL2_ttf library found: ${SDL2_TTF_LIBRARY}")
else()
message(FATAL_ERROR "SDL2_ttf library not found")
endif()
include_directories(${SDL2_INCLUDE_DIRS} src)
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
add_executable(SnakeGame ${SOURCE_FILES})
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
target_link_libraries(SnakeGame pthread ${SDL2_LIBRARIES} ${SDL2_TTF_LIBRARY})