Skip to content

Instantly share code, notes, and snippets.

@johnX9
Last active June 4, 2018 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnX9/928235843bc31d747c92e30f0bd4c26f to your computer and use it in GitHub Desktop.
Save johnX9/928235843bc31d747c92e30f0bd4c26f to your computer and use it in GitHub Desktop.
cmake_minimum_required(VERSION 3.5)
# Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/frameworks)
add_library(Catch INTERFACE)
target_include_directories(Catch INTERFACE ${CATCH_INCLUDE_DIR})
# Add unit tests files here
# Example: players_tests.cpp marketplace_tests.cpp and etc.
set(unit_tests_files
players_tests.cpp)
foreach(test_file ${unit_tests_files})
get_filename_component(file_name ${test_file} NAME_WE)
add_executable(${file_name} ${test_file})
target_link_libraries(${file_name} Catch)
add_test(NAME ${file_name} COMMAND ${file_name} "-s" "-r" "compact" "--use-colour" "yes")
endforeach()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment