From 4f742cb30d584e9c567f49aecf6f4978a4c5d791 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Sun, 29 Dec 2019 19:01:13 +0200 Subject: [PATCH] Use test globals --- test/CMakeLists.txt | 54 ++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index eddad2e..4913af0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,31 +4,31 @@ include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST) -if(HAVE_BOOST_TEST) - - set(link_libraries Boost::type_traits Boost::core Boost::function Boost::mpl) - set(compile_definitions CI_SUPPRESS_KNOWN_ISSUES) - - file(GLOB rtests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test*.cpp") - - foreach(test IN LISTS rtests) - - boost_test(TYPE run SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) - - endforeach() - - file(GLOB cftests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_fail/*.cpp") - - foreach(test IN LISTS cftests) - - boost_test(TYPE compile-fail SOURCES ${test} COMPILE_DEFINITIONS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) - - endforeach() - - foreach(test IN ITEMS has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test) - - boost_test(TYPE run NAME ${test}_no_intrinsics SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_TT_DISABLE_INTRINSICS ${compile_definitions} LINK_LIBRARIES ${link_libraries}) - - endforeach() - +if(NOT HAVE_BOOST_TEST) + return() endif() + +set(BOOST_TEST_LINK_LIBRARIES Boost::type_traits Boost::core Boost::function Boost::mpl) +set(BOOST_TEST_COMPILE_DEFINITIONS CI_SUPPRESS_KNOWN_ISSUES) + +file(GLOB rtests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*_test*.cpp") + +foreach(test IN LISTS rtests) + + boost_test(TYPE run SOURCES ${test}) + +endforeach() + +file(GLOB cftests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "compile_fail/*.cpp") + +foreach(test IN LISTS cftests) + + boost_test(TYPE compile-fail SOURCES ${test}) + +endforeach() + +foreach(test IN ITEMS has_nothrow_assign_test has_nothrow_constr_test has_nothrow_copy_test is_nothrow_move_assignable_test is_nothrow_move_constructible_test) + + boost_test(TYPE run NAME ${test}_no_intrinsics SOURCES ${test}.cpp COMPILE_DEFINITIONS BOOST_TT_DISABLE_INTRINSICS) + +endforeach()