identiconpp is a library to generate identicons for C++ and 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.

tests.CMakeLists.txt 1.1KB

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