-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
96 lines (78 loc) · 2.43 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
93
94
95
96
# Heather Michaud
# ---------------------------------------------------------------------------- #
# CMake configuration
cmake_minimum_required(VERSION 2.8)
# ---------------------------------------------------------------------------- #
# Project configuration
# Define the top-level project
project(fraud CXX)
enable_testing()
# Compiler config
set(CMAKE_CXX_FLAGS "-Wall -std=c++1y")
include_directories(.)
# ---------------------------------------------------------------------------- #
# Build
# Add the fraud library
add_library(fraud fraud.cpp)
# ---------------------------------------------------------------------------- #
# Testing
# This macro will create unit tests for a module.
macro(add_unit_test mod file)
set(tgt ${mod}.${file})
add_executable(${tgt} ${mod}.test/${file}.cpp)
target_link_libraries(${tgt} fraud)
add_test(test.${tgt} ${tgt})
endmacro()
# Add a test suite.
add_unit_test(fraud sum)
add_unit_test(fraud arithmetic_mean)
add_unit_test(fraud variance)
add_unit_test(fraud standard_deviation)
add_unit_test(fraud correlation_coefficient)
add_unit_test(fraud strongest_correlation)
add_unit_test(fraud accumulate)
add_unit_test(fraud mean)
# ---------------------------------------------------------------------------- #
# Submission
# The make_manifest macro creates targets that generate a PDF of
# your code for grading.
macro(make_manifest)
# Complete the paths to all files
set(src "")
set(doc "")
foreach(i ${ARGV})
# Make sure the file has its absolute path.
set(f ${CMAKE_CURRENT_SOURCE_DIR}/${i})
# What kind of file are we talking about?
# We're going to process them a little differently.
get_filename_component(ext ${i} EXT)
if (${ext} STREQUAL ".md")
list(APPEND doc ${f})
else()
list(APPEND src ${f})
endif()
endforeach()
# Generate the manifest target
set(outdoc "${CMAKE_CURRENT_BINARY_DIR}/doc.html")
add_custom_target(manifest
COMMAND pandoc ${doc} -o ${outdoc}
COMMAND a2ps -Afill -o manifest.ps ${outdoc} ${src}
COMMAND ps2pdf manifest.ps)
endmacro()
# Add files to be submitted and graded.
make_manifest(
README.md
fraud.hpp
fraud.cpp
concepts.hpp
composite.hpp
fraud.test/test.cpp
fraud.test/sum.cpp
fraud.test/accumulate.cpp
fraud.test/arithmetic_mean.cpp
fraud.test/mean.cpp
fraud.test/variance.cpp
fraud.test/standard_deviation.cpp
fraud.test/correlation_coefficient.cpp
fraud.test/strongest_correlation.cpp
)