forked from felipecastillotecmx/MathLib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
43 lines (32 loc) · 918 Bytes
/
CMakeLists.txt
File metadata and controls
43 lines (32 loc) · 918 Bytes
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
cmake_minimum_required(VERSION 3.30)
project(unit_test)
set(CMAKE_CXX_STANDARD 17)
set(SOURCES
main.cpp
MyMathLib.h
)
add_executable(unit_test main.cpp)
# Opciones
option(ENABLE_TESTING "Enable a Unit Testing build." ON)
# Descarga GoogleTest usando FetchContent
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.11.0
)
FetchContent_MakeAvailable(googletest)
# Si se habilitan las pruebas, agrega GoogleTest y las pruebas unitarias
if(ENABLE_TESTING)
enable_testing()
# Archivos de pruebas
set(TEST_SOURCES
test.cpp
)
# Crear ejecutable de pruebas
add_executable(test_suite ${TEST_SOURCES})
# Enlazar GoogleTest
target_link_libraries(test_suite PRIVATE gtest gtest_main)
# Registrar pruebas con CTest
add_test(NAME AllTests COMMAND test_suite)
endif()