aboutsummaryrefslogtreecommitdiff
path: root/tests/test_helpers.cmake
diff options
context:
space:
mode:
authorAlex Merry <alex.merry@kde.org>2015-05-18 19:12:06 +0100
committerAlex Merry <alex.merry@kde.org>2015-05-18 20:21:11 +0100
commitbe390dcc4d77d7faa95d040b1a346ac3c0405eac (patch)
tree1f04390ac4d186466fb2da2d02b4f3e12e422abb /tests/test_helpers.cmake
parent9f96174b61fbc1145fda4cfba573361a0aa8746d (diff)
downloadextra-cmake-modules-be390dcc4d77d7faa95d040b1a346ac3c0405eac.tar.gz
extra-cmake-modules-be390dcc4d77d7faa95d040b1a346ac3c0405eac.tar.bz2
Add arguments to ecm_add_tests for listing added tests.
This makes it convenient to make further modifications to the tests, such as setting properties on either the tests or the targets. CHANGELOG: New arguments for ecm_add_tests(). BUG: 345797 REVIEW: 123841
Diffstat (limited to 'tests/test_helpers.cmake')
-rw-r--r--tests/test_helpers.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_helpers.cmake b/tests/test_helpers.cmake
index 73be343e..d9314d25 100644
--- a/tests/test_helpers.cmake
+++ b/tests/test_helpers.cmake
@@ -62,3 +62,31 @@ macro(assert_var_absolute_path varname)
endif()
endmacro()
+function(assert_vars_setequal varname exp_varname)
+ if(ARGC LESS 3 OR NOT "${ARGV2}" STREQUAL "ALLOW_UNDEFINED")
+ assert_var_defined(${varname})
+ endif()
+ # need real variables
+ set(list1 "${${varname}}")
+ set(list2 "${${exp_varname}}")
+ list(LENGTH list1 list1_len)
+ list(LENGTH list2 list2_len)
+ set(same_els FALSE)
+ if(list1_len EQUAL list2_len)
+ set(same_els TRUE)
+ foreach(item ${list1})
+ list(FIND list2 "${item}" pos)
+ if(pos EQUAL "-1")
+ set(same_els FALSE)
+ break()
+ else()
+ # deal nicely with duplicates
+ list(REMOVE_AT list2 "${pos}")
+ endif()
+ endforeach()
+ endif()
+ if(NOT same_els)
+ message(SEND_ERROR "${varname} is '${${varname}}', expecting '${${exp_varname}}'.")
+ endif()
+endfunction()
+