Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Fat-Zer/5845272 to your computer and use it in GitHub Desktop.
Save Fat-Zer/5845272 to your computer and use it in GitHub Desktop.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9de61f2..26c3b5f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,6 +6,8 @@ find_package(PkgConfig REQUIRED)
pkg_check_modules(SOMELIBS vdpau glib-2.0 libswscale libva-glx gl glu REQUIRED)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
+add_custom_target(tests)
+add_dependencies(check test)
enable_testing()
add_subdirectory(tests)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8fd9b32..e65b816 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -8,38 +8,19 @@ pkg_check_modules(VDPAU vdpau REQUIRED)
link_libraries(${X11_LIBRARIES} ${VDPAU_LIBRARIES} -lpthread)
link_directories(${X11_LIBRARY_DIRS} ${VDPAU_LIBRARY_DIRS})
+list(APPEND _vdpau_init_tests
+ test-001 test-002 test-003 test-004 test-005 test-006
+ test-007 test-008 test-009 test-010)
+
+list(APPEND _tests test-000 ${_vdpau_init_tests})
+
add_executable(test-000 EXCLUDE_FROM_ALL test-000.c ../bitstream.c)
-add_executable(test-001 EXCLUDE_FROM_ALL test-001.c vdpau-init.c)
-add_executable(test-002 EXCLUDE_FROM_ALL test-002.c vdpau-init.c)
-add_executable(test-003 EXCLUDE_FROM_ALL test-003.c vdpau-init.c)
-add_executable(test-004 EXCLUDE_FROM_ALL test-004.c vdpau-init.c)
-add_executable(test-005 EXCLUDE_FROM_ALL test-005.c vdpau-init.c)
-add_executable(test-006 EXCLUDE_FROM_ALL test-006.c vdpau-init.c)
-add_executable(test-007 EXCLUDE_FROM_ALL test-007.c vdpau-init.c)
-add_executable(test-008 EXCLUDE_FROM_ALL test-008.c vdpau-init.c)
-add_executable(test-009 EXCLUDE_FROM_ALL test-009.c vdpau-init.c)
-add_executable(test-010 EXCLUDE_FROM_ALL test-010.c vdpau-init.c)
-add_test(test-000 ${CMAKE_CURRENT_BINARY_DIR}/test-000)
-add_test(test-001 ${CMAKE_CURRENT_BINARY_DIR}/test-001)
-add_test(test-002 ${CMAKE_CURRENT_BINARY_DIR}/test-002)
-add_test(test-003 ${CMAKE_CURRENT_BINARY_DIR}/test-003)
-add_test(test-004 ${CMAKE_CURRENT_BINARY_DIR}/test-004)
-add_test(test-005 ${CMAKE_CURRENT_BINARY_DIR}/test-005)
-add_test(test-006 ${CMAKE_CURRENT_BINARY_DIR}/test-006)
-add_test(test-007 ${CMAKE_CURRENT_BINARY_DIR}/test-007)
-add_test(test-008 ${CMAKE_CURRENT_BINARY_DIR}/test-008)
-add_test(test-009 ${CMAKE_CURRENT_BINARY_DIR}/test-009)
-add_test(test-010 ${CMAKE_CURRENT_BINARY_DIR}/test-010)
+foreach(_test ${_vdpau_init_tests})
+ add_executable(${_test} EXCLUDE_FROM_ALL "${_test}.c" vdpau-init.c)
+endforeach(_test)
-add_dependencies(check test-000)
-add_dependencies(check test-001)
-add_dependencies(check test-002)
-add_dependencies(check test-003)
-add_dependencies(check test-004)
-add_dependencies(check test-005)
-add_dependencies(check test-006)
-add_dependencies(check test-007)
-add_dependencies(check test-008)
-add_dependencies(check test-009)
-add_dependencies(check test-010)
+foreach(_test ${_tests})
+ add_test(${_test} ${CMAKE_CURRENT_BINARY_DIR}/${_test})
+ add_dependencies(tests ${_test})
+endforeach(_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment