summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt7
-rw-r--r--host-common/CMakeLists.txt4
-rw-r--r--stream-servers/CMakeLists.txt4
-rw-r--r--test_properties.cmake9
4 files changed, 22 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c2b081b5..45766eca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,3 +1,4 @@
+cmake_policy(SET CMP0048 NEW)
project(gfx-streaming-kit)
cmake_minimum_required(VERSION 3.11)
@@ -57,6 +58,12 @@ if (MSVC)
add_compile_definitions(_CRT_NONSTDC_NO_DEPRECATE)
endif()
+# Macro to easily set the TEST_INCLUDE_FILES properties to point to `test_properties.cmake`
+# This macro should be called at the end of any CMakeLists.txt file that defines test targets.
+macro("set_test_include_files")
+set_property(DIRECTORY APPEND PROPERTY TEST_INCLUDE_FILES ${CMAKE_SOURCE_DIR}/test_properties.cmake)
+endmacro()
+
# Uncomment for ASAN support
# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
# set (CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -fno-omit-frame-pointer -fsanitize=address")
diff --git a/host-common/CMakeLists.txt b/host-common/CMakeLists.txt
index fbd373e3..4ea9eb53 100644
--- a/host-common/CMakeLists.txt
+++ b/host-common/CMakeLists.txt
@@ -149,4 +149,6 @@ target_link_libraries(
gtest_main
gmock_main)
-gtest_discover_tests(gfxstream-host-common_unittests) \ No newline at end of file
+gtest_discover_tests(gfxstream-host-common_unittests)
+
+set_test_include_files()
diff --git a/stream-servers/CMakeLists.txt b/stream-servers/CMakeLists.txt
index b5fc30b4..42c12908 100644
--- a/stream-servers/CMakeLists.txt
+++ b/stream-servers/CMakeLists.txt
@@ -236,4 +236,6 @@ target_link_libraries(
gfxstream-host-common-testing-support
gtest
gmock)
-gtest_discover_tests(Vulkan_unittests) \ No newline at end of file
+gtest_discover_tests(Vulkan_unittests)
+
+set_test_include_files()
diff --git a/test_properties.cmake b/test_properties.cmake
new file mode 100644
index 00000000..e42f544f
--- /dev/null
+++ b/test_properties.cmake
@@ -0,0 +1,9 @@
+# This file is executed by CTest prior to running tests
+# It can be used to set extra properties on tests.
+#
+# Example:
+# set_tests_properties(MyTestSuite.SomeTest PROPERTIES LABELS foobar)
+#
+# For this to work:
+# 1. Use gtest_discover_tests() to add the test targets
+# 2. Call the set_test_include_files() macro at the end of each CMakeLists.txt that defines tests