CMakeLists.txt 1.7 KB

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