Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2020-07-16 13:58:49 +0300
committerSybren A. Stüvel <sybren@blender.org>2020-07-16 13:58:49 +0300
commit56aa5b0d8c6b66369f979e8bee4f1bd99454a99f (patch)
tree521ad55ec7da54988109d5105593fd817704cfa0 /source/blender/blenkernel/CMakeLists.txt
parent065a00ee3e6668172faae5a72027de8b1bca9d77 (diff)
T73268: Link C/C++ unit tests into single executable
This commit introduces a new way to build unit tests. It is now possible for each module to generate its own test library. The tests in these libraries are then bundled into a single executable. The test executable can be run with `ctest`. Even though the tests reside in a single executable, they are still exposed as individual tests to `ctest`, and thus can be selected via its `-R` argument. Not yet ported tests still build & run as before. The following rules apply: - Test code should reside in the same directory as the code under test. - Tests that target functionality in `somefile.{c,cc}` should reside in `somefile_test.cc`. - The namespace for tests is the `tests` sub-namespace of the code under test. For example, tests for `blender::bke` should be in `blender::bke:tests`. - The test files should be listed in the module's `CMakeLists.txt` in a `blender_add_test_lib()` call. See the `blenkernel` module for an example. Reviewed By: brecht Differential Revision: https://developer.blender.org/D7649
Diffstat (limited to 'source/blender/blenkernel/CMakeLists.txt')
-rw-r--r--source/blender/blenkernel/CMakeLists.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 25710ef29ca..97a283abbfb 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -701,3 +701,16 @@ blender_add_lib(bf_blenkernel "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
# Needed so we can use dna_type_offsets.h for defaults initialization.
add_dependencies(bf_blenkernel bf_dna)
+
+
+if(WITH_GTESTS)
+ set(TEST_SRC
+ intern/armature_test.cc
+ intern/fcurve_test.cc
+ )
+ set(TEST_INC
+ ../editors/include
+ )
+ include(GTestTesting)
+ blender_add_test_lib(bf_blenkernel_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB}")
+endif()