1 macro(package_add_test TESTNAME)
2 # create an exectuable in which the tests will be stored
3 add_executable(${TESTNAME} ${ARGN})
4 # link the Google test infrastructure, mocking library, and a default main fuction to
5 # the test executable. Remove g_test_main if writing your own main function.
6 target_link_libraries(${TESTNAME} gtest gtest_main DIPE)
7 # gtest_discover_tests replaces gtest_add_tests,
8 # see https://cmake.org/cmake/help/v3.10/module/GoogleTest.html for more options to pass to it
9 gtest_discover_tests(${TESTNAME}
10 # set a working directory so your project root so that you can find test data via paths relative to the project root
11 WORKING_DIRECTORY ${PROJECT_DIR}
12 PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_DIR}"
14 set_target_properties(${TESTNAME} PROPERTIES FOLDER tests)
17 add_subdirectory(/usr/src/gtest gtest)
19 package_add_test(testDIPE testDIPE.cpp)
20 package_add_test(testPBC testPBC.cpp)