Remove test when the feature is not available

This commit is contained in:
Roland Kaufmann
2012-11-25 23:06:39 +01:00
parent 6aae2aeda4
commit d37e7740bd

View File

@@ -98,6 +98,18 @@ target_link_libraries (opmcore ${opm-core_LIBRARIES})
# find the source code
file (GLOB_RECURSE tests_SOURCES "tests/*.c" "tests/*.cpp")
# conditionally disable tests when features aren't available
macro (cond_disable_test name)
if ((NOT DEFINED ${HAVE_${name}}) OR (NOT ${HAVE_${name}}))
message (STATUS "${name} test disabled, since ${name} is not found.")
string (TOLOWER "${name}" name_lower)
get_filename_component (test_${name}_FILE "tests/test_${name_lower}.cpp" ABSOLUTE)
list (REMOVE_ITEM tests_SOURCES "${test_${name}_FILE}")
endif ((NOT DEFINED ${HAVE_${name}}) OR (NOT ${HAVE_${name}}))
endmacro (cond_disable_test name)
cond_disable_test ("AGMG")
cond_disable_test ("ERT")
# compile each of these separately
foreach (test_FILE IN LISTS tests_SOURCES)
get_filename_component (test_NAME "${test_FILE}" NAME_WE)