From 901c7d31f026cce75816cf5d954e42f22f6f5691 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 16 Jul 2018 18:35:05 +0200 Subject: Fix usage of EIGEN_SPLIT_LARGE_TESTS=ON: some unit tests, such as indexed_view have to be split unconditionally. --- cmake/EigenTesting.cmake | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'cmake') diff --git a/cmake/EigenTesting.cmake b/cmake/EigenTesting.cmake index 58f3697d3..5ad57ad6c 100644 --- a/cmake/EigenTesting.cmake +++ b/cmake/EigenTesting.cmake @@ -108,7 +108,7 @@ macro(ei_add_test_internal testname testname_with_suffix) add_test(${testname_with_suffix} "${targetname}") - # Specify target and test labels accoirding to EIGEN_CURRENT_SUBPROJECT + # Specify target and test labels according to EIGEN_CURRENT_SUBPROJECT get_property(current_subproject GLOBAL PROPERTY EIGEN_CURRENT_SUBPROJECT) if ((current_subproject) AND (NOT (current_subproject STREQUAL ""))) set_property(TARGET ${targetname} PROPERTY LABELS "Build${current_subproject}") @@ -276,12 +276,19 @@ macro(ei_add_test testname) endif() file(READ "${filename}" test_source) - set(parts 0) string(REGEX MATCHALL "CALL_SUBTEST_[0-9]+|EIGEN_TEST_PART_[0-9]+|EIGEN_SUFFIXES(;[0-9]+)+" occurrences "${test_source}") string(REGEX REPLACE "CALL_SUBTEST_|EIGEN_TEST_PART_|EIGEN_SUFFIXES" "" suffixes "${occurrences}") list(REMOVE_DUPLICATES suffixes) - if(EIGEN_SPLIT_LARGE_TESTS AND suffixes) + set(explicit_suffixes "") + if( (NOT EIGEN_SPLIT_LARGE_TESTS) AND suffixes) + # Check whether we have EIGEN_TEST_PART_* statements, in which case we likely must enforce splitting. + # For instance, indexed_view activate a different c++ version for each part. + string(REGEX MATCHALL "EIGEN_TEST_PART_[0-9]+" occurrences "${test_source}") + string(REGEX REPLACE "EIGEN_TEST_PART_" "" explicit_suffixes "${occurrences}") + list(REMOVE_DUPLICATES explicit_suffixes) + endif() + if( (EIGEN_SPLIT_LARGE_TESTS AND suffixes) OR explicit_suffixes) add_custom_target(${testname}) foreach(suffix ${suffixes}) ei_add_test_internal(${testname} ${testname}_${suffix} -- cgit v1.2.3