Changeset View
Changeset View
Standalone View
Standalone View
cmake/modules/TestSuite.cmake
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | add_test_runner( | ||||
${NAME} -t "${_test_name}" -l test_suite | ${NAME} -t "${_test_name}" -l test_suite | ||||
) | ) | ||||
set_property( | set_property( | ||||
TARGET ${SUITE_TARGET} | TARGET ${SUITE_TARGET} | ||||
APPEND PROPERTY UNIT_TESTS ${_test_name} | APPEND PROPERTY UNIT_TESTS ${_test_name} | ||||
) | ) | ||||
endforeach() | endforeach() | ||||
find_package(Boost 1.58 REQUIRED unit_test_framework) | find_package(Boost 1.59 REQUIRED unit_test_framework) | ||||
target_link_libraries(${NAME} Boost::unit_test_framework) | target_link_libraries(${NAME} Boost::unit_test_framework) | ||||
# We need to detect if the BOOST_TEST_DYN_LINK flag is required | # We need to detect if the BOOST_TEST_DYN_LINK flag is required | ||||
include(CheckCXXSourceCompiles) | include(CheckCXXSourceCompiles) | ||||
set(CMAKE_REQUIRED_LIBRARIES Boost::unit_test_framework) | set(CMAKE_REQUIRED_LIBRARIES Boost::unit_test_framework) | ||||
check_cxx_source_compiles(" | check_cxx_source_compiles(" | ||||
#define BOOST_TEST_DYN_LINK | #define BOOST_TEST_DYN_LINK | ||||
#define BOOST_TEST_MAIN | #define BOOST_TEST_MAIN | ||||
#include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||
" BOOST_REQUIRES_TEST_DYN_LINK) | " BOOST_REQUIRES_TEST_DYN_LINK) | ||||
if(BOOST_REQUIRES_TEST_DYN_LINK) | if(BOOST_REQUIRES_TEST_DYN_LINK) | ||||
target_compile_definitions(${NAME} PRIVATE BOOST_TEST_DYN_LINK) | target_compile_definitions(${NAME} PRIVATE BOOST_TEST_DYN_LINK) | ||||
endif() | endif() | ||||
endfunction(add_boost_unit_tests_to_suite) | endfunction(add_boost_unit_tests_to_suite) |