-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
92 lines (69 loc) · 2.14 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
cmake_minimum_required(VERSION 3.8.2)
project(eksplorer CXX)
##################### Finding packages ###############################
find_package(Boost REQUIRED COMPONENTS serialization)
find_package(GTest REQUIRED)
find_package(Curses REQUIRED)
find_program(CLANG-CHECK clang-check)
message(${CLANG-CHECK})
find_program(CLANG-FORMAT clang-format)
message(${CLANG-FORMAT})
find_program(GCOV gcov)
message(${GCOV})
find_program(MAKE make)
message(${MAKE})
find_program(VALGRIND valgrind)
message(${VALGRIND})
#add_compile_options (-fprofile-arcs -ftest-coverage)
add_compile_options(-pedantic -Wall -Weffc++)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS ON)
link_libraries(gtest)
link_libraries(gtest_main)
link_libraries(${CURSES_LIBRARIES})
enable_testing()
##################### Targets ###############################
function(make_test TestName)
add_executable(${TestName} ${ARGN})
add_custom_command(OUTPUT ${TestName}.tmp COMMAND ${VALGRIND} ${TestName} > ${TestName}.tmp)
add_custom_target(${TestName}.c++x DEPENDS ${TestName}.tmp)
add_test(${TestName}.check1 ${CLANG-CHECK} -extra-arg=-std=c++11 ../${TestName}.c++ --)
add_test(${TestName}.check2 ${CLANG-CHECK} -extra-arg=-std=c++11 -analyze ../${TestName}.c++ --)
add_test(${TestName} ${MAKE} ${TestName}.c++x)
set_property(DIRECTORY APPEND PROPERTY
ADDITIONAL_MAKE_CLEAN_FILES "${TestName}.bin" "${TestName}.plist")
endfunction()
add_executable(Main main.cpp
)
target_link_libraries(Main stdc++fs)
##################### Versions #############################
add_custom_target(versions)
set(APPS
clang-check
clang-format
cmake
doxygen
g++
gcov
git
make
valgrind)
foreach (app ${APPS})
add_custom_command(TARGET versions
COMMAND echo which ${app}
COMMAND which ${app}
COMMAND echo ${app} --version
COMMAND ${app} --version
COMMAND echo)
endforeach ()
set(PKGS
Boost
GTest)
foreach (pkg ${PKGS})
add_custom_command(TARGET versions
COMMAND echo ${pkg}_VERSION
COMMAND echo ${${pkg}_VERSION}
COMMAND echo)
endforeach ()