-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
45 lines (35 loc) · 961 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
35
36
37
38
39
40
41
42
43
44
45
# Only for cmake --version >= 3.5.1
cmake_minimum_required(VERSION 3.5.1)
# Project name
project(invaders)
# Creates the variable EXEC and sets it to chip8
set(EXEC invaders)
# Set the C++17 standard
set(CMAKE_CXX_STANDARD 17)
# Set vcpkg environment
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CRT_LINKAGE static)
# Find OpenGL
find_package(OpenGL REQUIRED)
# Find all vcpkg packages
find_package(SDL2 CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
# Puts all .cpp files inside src
file(GLOB_RECURSE SOURCES_INVADERS src/*.cpp)
set(SOURCES
${SOURCES_INVADERS}
)
# Compiles the files defined by SOURCES to generante the executable defined by EXEC
add_executable(${EXEC} ${SOURCES})
# Link with libs
target_link_libraries(${EXEC}
PRIVATE
SDL2::SDL2main
SDL2::SDL2
SDL2::SDL2-static
)
target_link_libraries(${EXEC}
PRIVATE
imgui::imgui
)
target_link_libraries(${EXEC} PRIVATE OpenGL::GL)