Build tests as a separate target

It is very annoying having to build all the tests when you are
testing some code in the main library. Someone downloading the
library probably doesn't need the tests either, so these are left
out of the default target.
This commit is contained in:
Roland Kaufmann
2013-01-10 12:58:52 +01:00
parent ce73423ba4
commit 20153000bc

View File

@@ -217,9 +217,11 @@ cond_disable_test ("AGMG")
cond_disable_test ("ERT")
# compile each of these separately
add_custom_target (tests)
foreach (test_FILE IN LISTS tests_SOURCES)
get_filename_component (test_NAME "${test_FILE}" NAME_WE)
add_executable (${test_NAME} ${test_FILE})
add_executable (${test_NAME} EXCLUDE_FROM_ALL ${test_FILE})
add_dependencies (tests ${test_NAME})
set_target_properties (${test_NAME} PROPERTIES
LINK_FLAGS "${opm-core_LINKER_FLAGS_STR}"
)