-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (49 loc) · 1.16 KB
/
CMakeLists.txt
File metadata and controls
59 lines (49 loc) · 1.16 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
50
51
52
53
54
55
56
57
58
59
# Version CMake
cmake_minimum_required(VERSION 3.10)
# Project name
project(main)
# Directory googletest
if(TEST)
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/googletest")
endif()
# Options
set(CMAKE_CXX_STANDARD 11)
# Source files
set(SOURCES
source/main.cpp
source/equal.cpp
source/sum.cpp
include/min.h
include/less_than_zero.h
)
# Source tests files
set(TEST_SOURCES
test/source/test_equal.cpp
test/source/test_sum.cpp
test/source/test_min.cpp
test/source/test_less_than_zero.cpp
source/equal.cpp
source/sum.cpp
include/min.h
include/less_than_zero.h
)
# Include directories
if(TEST)
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include")
endif()
include_directories("${CMAKE_CURRENT_SOURCE_DIR}")
# Set build type
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif(NOT CMAKE_BUILD_TYPE)
# Compiling target
add_executable(${PROJECT_NAME} ${SOURCES})
if(TEST)
# Compiling target for tests
add_executable(${PROJECT_NAME}_tests ${TEST_SOURCES})
# Link target with gtest
target_link_libraries(${PROJECT_NAME}_tests
gtest
gtest_main
)
endif()