-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (40 loc) · 1.28 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
cmake_minimum_required(VERSION 3.0.0)
project(tetrix LANGUAGES C VERSION 0.1.0)
include(CTest)
enable_testing()
# Crea il modulo tetrix e aggiunge l'eseguibile main.c
add_executable(tetrix src/main.c)
add_executable(tester src/tester.c)
# Crea il modulo libtetrix e aggiunge i file come librerie
add_library(libtetrix
src/gamefield.c
src/player.c
src/singleplayer.c
src/multiplayer.c
src/tetrimino.c
src/functions.c
src/constants.c
src/bot.c
src/networking.c
src/net_game.c
)
# Collega il modulo libetetrix a tetrix
target_link_libraries(tetrix libtetrix)
target_link_libraries(tester libtetrix)
# Permette di includere nel progetto la cartella "include"
include_directories(include)
# Specifica la versione ANSI C per i moduli
set_property(TARGET tetrix PROPERTY C_STANDARD 90)
set_property(TARGET libtetrix PROPERTY C_STANDARD 90)
# Importa la libreria ncurses
find_package(Curses REQUIRED)
include_directories(${CURSES_INCLUDE_DIR})
target_link_libraries(tetrix ${CURSES_LIBRARIES})
target_link_libraries(tester ${CURSES_LIBRARIES})
# Test valgrind
add_test(NAME mem_check COMMAND valgrind ./tetrix)
file(GLOB SOURCES "*.c")
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
add_compile_definitions(DEBUG)