• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7add_custom_target(tests COMMENT "Build all the unit tests.")
8add_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
17function(boost_callable_traits_add_unit_test name)
18    boost_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()
23endfunction()
24
25include_directories(${boost_callable_traits_SOURCE_DIR}/include)
26include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
27include_directories(${CMAKE_CURRENT_LIST_DIR})
28
29file(GLOB_RECURSE UNIT_TESTS "*.cpp")
30
31foreach(_file IN LISTS UNIT_TESTS)
32    boost_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    boost_callable_traits_add_unit_test(${_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target})
38    boost_callable_traits_add_unit_test(${lazy_target} ${CMAKE_CURRENT_BINARY_DIR}/${_target})
39endforeach()
40
41add_dependencies(callable_traits_check tests)
42