changed: disable building of test suite if Boost::test is not found

This commit is contained in:
Arne Morten Kvarving 2020-02-19 12:24:53 +01:00
parent ec1dabf80e
commit f76daabbb4
3 changed files with 12 additions and 4 deletions

View File

@ -174,7 +174,8 @@ if (ENABLE_MOCKSIM)
foreach( test test_msim test_msim_ACTIONX ) foreach( test test_msim test_msim_ACTIONX )
opm_add_test(${test} SOURCES tests/msim/${test}.cpp opm_add_test(${test} SOURCES tests/msim/${test}.cpp
LIBRARIES ${_libs} LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests) WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests
CONDITION HAVE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND)
endforeach() endforeach()
endif() endif()
@ -205,7 +206,7 @@ if(ENABLE_ECL_INPUT)
opm_add_test(test_EclFilesComparator opm_add_test(test_EclFilesComparator
CONDITION CONDITION
ENABLE_ECL_INPUT ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
SOURCES SOURCES
tests/test_EclFilesComparator.cpp tests/test_EclFilesComparator.cpp
test_util/EclFilesComparator.cpp test_util/EclFilesComparator.cpp
@ -217,7 +218,7 @@ if(ENABLE_ECL_INPUT)
opm_add_test(test_EclRegressionTest opm_add_test(test_EclRegressionTest
CONDITION CONDITION
ENABLE_ECL_INPUT ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
SOURCES SOURCES
tests/test_EclRegressionTest.cpp tests/test_EclRegressionTest.cpp
test_util/EclFilesComparator.cpp test_util/EclFilesComparator.cpp
@ -229,7 +230,7 @@ if(ENABLE_ECL_INPUT)
) )
foreach(test test_EclIO test_EGrid test_ERft test_ERst test_ESmry) foreach(test test_EclIO test_EGrid test_ERft test_ERst test_ESmry)
opm_add_test(${test} CONDITION ENABLE_ECL_INPUT opm_add_test(${test} CONDITION ENABLE_ECL_INPUT AND Boost_UNIT_TEST_FRAMEWORK_FOUND
LIBRARIES ${_libs} LIBRARIES ${_libs}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests) WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/tests)
endforeach() endforeach()

View File

@ -2,6 +2,8 @@
set(TEST_LIBS opmcommon Boost::unit_test_framework) set(TEST_LIBS opmcommon Boost::unit_test_framework)
set(EXTRA_TESTS) set(EXTRA_TESTS)
if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
# Generated source, needs to be here # Generated source, needs to be here
opm_add_test(InlineKeywordTest opm_add_test(InlineKeywordTest
EXE_NAME TestKeywords EXE_NAME TestKeywords
@ -113,3 +115,5 @@ opm_add_test(jsonTests
LIBRARIES ${TEST_LIBS} LIBRARIES ${TEST_LIBS}
TEST_ARGS ${PROJECT_SOURCE_DIR}/tests/json/example1.json) TEST_ARGS ${PROJECT_SOURCE_DIR}/tests/json/example1.json)
list(APPEND EXTRA_TESTS jsonTests) list(APPEND EXTRA_TESTS jsonTests)
endif()

View File

@ -56,6 +56,9 @@ macro (opm_compile_satellites opm satellite excl_all test_regexp)
# compile each of these separately # compile each of these separately
foreach (_sat_FILE IN LISTS ${satellite}_SOURCES) foreach (_sat_FILE IN LISTS ${satellite}_SOURCES)
if (NOT "${test_regexp}" STREQUAL "" AND NOT Boost_UNIT_TEST_FRAMEWORK_FOUND)
continue()
endif()
get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE) get_filename_component (_sat_NAME "${_sat_FILE}" NAME_WE)
add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE}) add_executable (${_sat_NAME} ${excl_all} ${_sat_FILE})
add_dependencies (${satellite} ${_sat_NAME}) add_dependencies (${satellite} ${_sat_NAME})