diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-06-18 16:49:17 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-06-18 20:09:16 +0400 |
commit | 306cbb82ecf0d7c1ba4fb0a1240175b1976bd25b (patch) | |
tree | e9eac65bf57126ac233f22fe88cc00df137ec4e5 /build_files/cmake/Modules/GTestTesting.cmake | |
parent | 47ec0394ca3d03e07c07a67e8f8d1625aedd39dd (diff) |
GTest unit testing framework
Currently covers only small set of functionality.
Diffstat (limited to 'build_files/cmake/Modules/GTestTesting.cmake')
-rw-r--r-- | build_files/cmake/Modules/GTestTesting.cmake | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/build_files/cmake/Modules/GTestTesting.cmake b/build_files/cmake/Modules/GTestTesting.cmake new file mode 100644 index 00000000000..c039a1e1760 --- /dev/null +++ b/build_files/cmake/Modules/GTestTesting.cmake @@ -0,0 +1,47 @@ +#============================================================================= +# Copyright 2014 Blender Foundation. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +# +# Inspired on the Testing.cmake from Libmv +# +#============================================================================= + +macro(BLENDER_SRC_GTEST NAME SRC EXTRA_LIBS) + if(WITH_TESTS) + get_property(_current_include_directories + DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + PROPERTY INCLUDE_DIRECTORIES) + set(TEST_INC + ${_current_include_directories} + ${CMAKE_SOURCE_DIR}/tests/gtests + ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/glog/src + ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/gflags + ${CMAKE_SOURCE_DIR}/extern/gtest/include + ) + unset(_current_include_directories) + + add_executable(${NAME}_test ${SRC}) + target_link_libraries(${NAME}_test + ${EXTRA_LIBS} + bf_testing_main + bf_intern_guardedalloc + extern_gtest + extern_glog) + set_target_properties(${NAME}_test PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${TESTS_OUTPUT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_RELEASE "${TESTS_OUTPUT_DIR}" + RUNTIME_OUTPUT_DIRECTORY_DEBUG "${TESTS_OUTPUT_DIR}" + INCLUDE_DIRECTORIES "${TEST_INC}") + add_test(${NAME}_test ${TESTS_OUTPUT_DIR}/${NAME}_test) + endif() +endmacro() + +macro(BLENDER_TEST NAME EXTRA_LIBS) + BLENDER_SRC_GTEST("${NAME}" "${NAME}_test.cc" "${EXTRA_LIBS}") +endmacro() |