]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | |
2 | # Copyright Louis Dionne 2015 | |
3 | # Modified Work Copyright Barrett Adair 2015-2017 | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
5 | # (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | add_custom_target(tests COMMENT "Build all the unit tests.") | |
8 | add_custom_target(tests.quick COMMENT "Build a subset of all the unit tests to finish faster.") | |
9 | ||
10 | ############################################################################## | |
11 | # callable_traits_add_unit_test(<name> ...) | |
12 | # | |
13 | # Equivalent to `callable_traits_add_test`, except the test is also added as a | |
14 | # dependency of the `tests` target. | |
15 | ############################################################################## | |
16 | ||
17 | function(callable_traits_add_unit_test name) | |
18 | callable_traits_add_test(${ARGV}) | |
19 | add_dependencies(tests ${name}) | |
20 | if ((NOT "${name}" MATCHES "\\.ext\\.") AND (NOT "${name}" MATCHES "_mcd")) | |
21 | add_dependencies(tests.quick ${name}) | |
22 | endif() | |
23 | endfunction() | |
24 | ||
25 | include_directories(${callable_traits_SOURCE_DIR}/include) | |
26 | include_directories(${CMAKE_CURRENT_LIST_DIR}/include) | |
27 | include_directories(${CMAKE_CURRENT_LIST_DIR}) | |
28 | ||
29 | file(GLOB_RECURSE UNIT_TESTS "*.cpp") | |
30 | ||
31 | foreach(_file IN LISTS UNIT_TESTS) | |
32 | callable_traits_target_name_for(_target "${_file}") | |
33 | add_executable(${_target} EXCLUDE_FROM_ALL "${_file}") | |
34 | set(lazy_target "lazy_${_target}") | |
35 | add_executable(${lazy_target} EXCLUDE_FROM_ALL "${_file}") | |
36 | target_compile_definitions(${lazy_target} INTERFACE -DUSE_LAZY_TYPES) | |
37 | callable_traits_add_unit_test(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target}) | |
38 | callable_traits_add_unit_test(${lazy_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target}) | |
39 | endforeach() | |
40 | ||
41 | add_dependencies(check tests) |