diff options
author | Jose Fonseca <jfonseca@vmware.com> | 2015-08-14 10:02:18 +0100 |
---|---|---|
committer | Jose Fonseca <jfonseca@vmware.com> | 2015-08-14 11:20:28 +0100 |
commit | 1ee5efdc5e1eca0fcb23f19ac6e7bb156d6c69ed (patch) | |
tree | e173647de89d37a83390136d88c5519b6ff0b248 /CMakeLists.txt | |
parent | 3ff3f99a4bae85c82263e07781ffea7fcfa27974 (diff) |
cmake: Add a convenience macro for gtest based unit tests.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 41cdd5a5..e896aa3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -481,6 +481,14 @@ target_link_libraries (gtest ${CMAKE_THREAD_LIBS_INIT}) enable_testing () add_custom_target (check COMMAND ${CMAKE_CTEST_COMMAND}) +# Convenience macro for adding unit tests +macro (add_gtest) + add_executable (${ARGV}) + target_link_libraries (${ARGV0} gtest) + add_dependencies (check ${ARGV0}) + add_test (NAME ${ARGV0} COMMAND $<TARGET_FILE:${ARGV0}>) +endmacro () + ############################################################################## # Common libraries / utilities |