-
Notifications
You must be signed in to change notification settings - Fork 77
/
CMakeLists.txt
118 lines (105 loc) · 2.67 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
if (CMAKE_VERSION VERSION_LESS 2.8.9) # TODO remove once we increase the cmake requirement
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -DPIC")
else()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()
set(TEST_SRCS dict_test.cc
logval_test.cc
m_test.cc
small_vector_test.cc
stringlib_test.cc
sv_test.cc
ts.cc
weights_test.cc)
foreach(testSrc ${TEST_SRCS})
#Extract the filename without an extension (NAME_WE)
get_filename_component(testName ${testSrc} NAME_WE)
#Add compile target
set_source_files_properties(${testSrc} PROPERTIES COMPILE_FLAGS "-DBOOST_TEST_DYN_LINK -DTEST_DATA=\\\"test_data/\\\"")
add_executable(${testName} ${testSrc})
#link to Boost libraries AND your targets and dependencies
target_link_libraries(${testName} utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
#I like to move testing binaries into a testBin directory
set_target_properties(${testName} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
#Finally add it to test execution -
#Notice the WORKING_DIRECTORY and COMMAND
add_test(NAME ${testName} COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/${testName}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endforeach(testSrc)
set(atools_SRCS atools.cc)
add_executable(atools ${atools_SRCS})
target_link_libraries(atools utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
set(dedup_corpus_SRCS dedup_corpus.cc)
add_executable(dedup_corpus ${dedup_corpus_SRCS})
target_link_libraries(dedup_corpus utils ${Boost_LIBRARIES} ${ZLIB_LIBRARIES})
set(utils_STAT_SRCS
test_data
alias_sampler.h
alignment_io.h
array2d.h
b64featvector.h
b64tools.h
batched_append.h
city.h
citycrc.h
corpus_tools.h
dict.h
exp_semiring.h
fast_sparse_vector.h
fdict.h
feature_vector.h
filelib.h
gzstream.h
hash.h
have_64_bits.h
indices_after.h
kernel_string_subseq.h
logval.h
m.h
maxent.h
maxent.cpp
murmur_hash3.h
murmur_hash3.cc
named_enum.h
null_deleter.h
null_traits.h
prob.h
sampler.h
semiring.h
show.h
small_vector.h
sparse_vector.h
star.h
static_utoa.h
stringlib.h
string_piece.hh
tdict.h
timing_stats.h
utoa.h
value_array.h
verbose.h
warning_compiler.h
warning_pop.h
warning_push.h
weights.h
wordid.h
writer.h
fast_lexical_cast.hpp
intrusive_refcount.hpp
alignment_io.cc
b64featvector.cc
b64tools.cc
corpus_tools.cc
dict.cc
tdict.cc
fdict.cc
gzstream.cc
filelib.cc
stringlib.cc
string_piece.cc
sparse_vector.cc
timing_stats.cc
verbose.cc
weights.cc)
add_library(utils STATIC ${utils_STAT_SRCS})