aboutsummaryrefslogtreecommitdiff
path: root/modules/ECMAddTests.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'modules/ECMAddTests.cmake')
-rw-r--r--modules/ECMAddTests.cmake16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/ECMAddTests.cmake b/modules/ECMAddTests.cmake
index bdb60691..ee7e63e3 100644
--- a/modules/ECMAddTests.cmake
+++ b/modules/ECMAddTests.cmake
@@ -9,7 +9,8 @@
# ecm_add_test(<sources> LINK_LIBRARIES <library> [<library> [...]]
# [TEST_NAME <name>]
# [NAME_PREFIX <prefix>]
-# [GUI])
+# [GUI]
+# [PROPERTIES <prop1> <value1> [<prop2> <value2> [...]]])
#
# Add a new unit test using the passed source files. The parameter TEST_NAME is
# used to set the name of the resulting test, and the target built for and run
@@ -27,6 +28,8 @@
# of CMAKE_WIN32_EXECUTABLE or CMAKE_MACOSX_BUNDLE). The test will be linked
# against the libraries and/or targets passed to LINK_LIBRARIES.
#
+# The PROPERTIES argument sets the given properties on the test.
+#
# The generated target executable will have the effects of ecm_mark_as_test()
# (from the :module:`ECMMarkAsTest` module) applied to it.
#
@@ -35,7 +38,8 @@
#
# ecm_add_tests(<sources> LINK_LIBRARIES <library> [<library> [...]]
# [NAME_PREFIX <prefix>]
-# [GUI])
+# [GUI]
+# [PROPERTIES <prop1> <value1> [<prop2> <value2> [...]]])
#
# This is a convenient version of ecm_add_test() for when you have many tests
# that consist of a single source file each. It behaves like calling
@@ -63,7 +67,7 @@ include(ECMMarkNonGuiExecutable)
function(ecm_add_test)
set(options GUI)
set(oneValueArgs TEST_NAME NAME_PREFIX)
- set(multiValueArgs LINK_LIBRARIES)
+ set(multiValueArgs LINK_LIBRARIES PROPERTIES)
cmake_parse_arguments(ECM_ADD_TEST "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(_sources ${ECM_ADD_TEST_UNPARSED_ARGUMENTS})
list(LENGTH _sources _sourceCount)
@@ -89,12 +93,15 @@ function(ecm_add_test)
add_test(NAME ${_testname} COMMAND ${_targetname})
target_link_libraries(${_targetname} ${ECM_ADD_TEST_LINK_LIBRARIES})
ecm_mark_as_test(${_targetname})
+ if (ECM_ADD_TEST_PROPERTIES)
+ set_tests_properties(${_testname} PROPERTIES ${ECM_ADD_TEST_PROPERTIES})
+ endif()
endfunction()
function(ecm_add_tests)
set(options GUI)
set(oneValueArgs NAME_PREFIX)
- set(multiValueArgs LINK_LIBRARIES)
+ set(multiValueArgs LINK_LIBRARIES PROPERTIES)
cmake_parse_arguments(ECM_ADD_TESTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(ECM_ADD_TESTS_GUI)
set(_exe_type GUI)
@@ -106,6 +113,7 @@ function(ecm_add_tests)
NAME_PREFIX ${ECM_ADD_TESTS_NAME_PREFIX}
LINK_LIBRARIES ${ECM_ADD_TESTS_LINK_LIBRARIES}
${_exe_type}
+ PROPERTIES ${ECM_ADD_TESTS_PROPERTIES}
)
endforeach()
endfunction()