summaryrefslogtreecommitdiff
path: root/cmake/utils/TestUtils.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/utils/TestUtils.cmake')
-rw-r--r--cmake/utils/TestUtils.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmake/utils/TestUtils.cmake b/cmake/utils/TestUtils.cmake
new file mode 100644
index 00000000..e40bdda1
--- /dev/null
+++ b/cmake/utils/TestUtils.cmake
@@ -0,0 +1,6 @@
+# Compute test name prefix from directory structure
+function(compute_test_prefix)
+ file(RELATIVE_PATH _prefix "${CMAKE_SOURCE_DIR}/src" "${CMAKE_CURRENT_SOURCE_DIR}")
+ string(REGEX REPLACE "/tests$" "" _prefix "${_prefix}")
+ set(TEST_PREFIX "${_prefix}" PARENT_SCOPE)
+endfunction(compute_test_prefix)