summaryrefslogtreecommitdiff
path: root/cmake/CompileGTest.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/CompileGTest.cmake')
-rw-r--r--cmake/CompileGTest.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmake/CompileGTest.cmake b/cmake/CompileGTest.cmake
index 520ca06a..1974901e 100644
--- a/cmake/CompileGTest.cmake
+++ b/cmake/CompileGTest.cmake
@@ -47,3 +47,12 @@ if(GTEST_ALL_CC)
47 endif() 47 endif()
48 endif() 48 endif()
49endif() 49endif()
50
51function(unit_test subdir target)
52 if(HAVE_GTEST)
53 add_executable(unit_${target}_test ${subdir}/${target}_test.cpp)
54 target_link_modules(unit_${target}_test toxcore gtest)
55 set_target_properties(unit_${target}_test PROPERTIES COMPILE_FLAGS "${TEST_CXX_FLAGS}")
56 add_test(NAME ${target} COMMAND ${CROSSCOMPILING_EMULATOR} unit_${target}_test)
57 endif()
58endfunction()