identiconpp is a library to generate identicons for C++.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
843B

  1. include(CTest)
  2. file(GLOB sources_tests test_*.cpp)
  3. find_package(Catch2)
  4. if(Catch2_FOUND) # Catch 2.x
  5. include(Catch)
  6. add_executable(all_tests main.cpp ${sources_tests})
  7. target_link_libraries(all_tests Catch2::Catch2 ${PROJECT_NAME})
  8. target_include_directories(all_tests PRIVATE "/usr/include/catch2")
  9. catch_discover_tests(all_tests EXTRA_ARGS "${EXTRA_TEST_ARGS}")
  10. else() # Catch 1.x
  11. if(EXISTS "/usr/include/catch.hpp")
  12. message(STATUS "Catch 1.x found.")
  13. foreach(src ${sources_tests})
  14. get_filename_component(bin ${src} NAME_WE)
  15. add_executable(${bin} main.cpp ${src})
  16. target_link_libraries(${bin} ${PROJECT_NAME})
  17. add_test(${bin} ${bin} "${EXTRA_TEST_ARGS}")
  18. endforeach()
  19. else()
  20. message(FATAL_ERROR
  21. "Neither Catch 2.x nor Catch 1.x could be found.")
  22. endif()
  23. endif()