-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
49 lines (34 loc) · 1.64 KB
/
Copy pathCMakeLists.txt
File metadata and controls
49 lines (34 loc) · 1.64 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
cmake_minimum_required(VERSION 3.5)
project(TP4_Pacalgo2)
option(WITH_GUI "Preparar compilacion con interfaz grafica (necesita SDL instalado)" OFF)
# IMPORTANTE: Descomentar la siguiente linea para preparar compilacion con interfaz grafica (leer el readme para las instrucciones completas)
# set(WITH_GUI ON)
set(CMAKE_CXX_STANDARD 11)
# Algunos flags para pasar al compilador (gnu++11 en vez de c++11 para que sea cross-plat)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=gnu++11 -ggdb3 -g")
# Dependencia de Google Test
SET(BUILD_GMOCK OFF)
SET(BUILD_GTEST ON)
add_library(gtest STATIC tests/gtest-1.8.1/gtest-all.cc)
add_library(gtest_main STATIC tests/gtest-1.8.1/gtest_main.cc)
# Leemos todos los archivos fuentes en ./src
file(GLOB SOURCE_FILES src/*.cpp src/*.h src/*.hpp)
if (WITH_GUI)
# Leemos todos los archivos fuentes en ./gui
file(GLOB GUI_FILES gui/*.cpp gui/*.h gui/*.hpp)
# En caso de no encontrar la biblioteca SDL, probar descomentando la siguiente línea
# set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake_modulos/)
find_package(SDL2 REQUIRED CONFIG)
include_directories(${SDL2_INCLUDE_DIRS})
add_executable(pacalgo2GUI gui/main.cpp ${GUI_FILES} ${SOURCE_FILES})
target_link_libraries(pacalgo2GUI ${SDL2_LIBRARIES})
endif (WITH_GUI)
add_executable(correrTests ${SOURCE_FILES} tests/fichin-tests.cpp)
# Necesitamos asociar los archivos del framework de testing
target_link_libraries(correrTests gtest gtest_main)
# Test suites a ejecutar
add_test(correrTests fichin_test)
# Target para correr Valgrind
add_custom_target(correrValgrind
valgrind --leak-check=full -v ./correrTests 2>&1
DEPENDS correrTests)