katja/tests/CMakeLists.txt

20 lines
733 B
CMake

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
find_package(Boost CONFIG COMPONENTS unit_test_framework REQUIRED)
file(GLOB KATJA_TEST_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
foreach(test_source ${KATJA_TEST_SOURCES})
get_filename_component(test_name ${test_source} NAME_WE)
set(tester ${test_name}-tester)
add_executable(${tester} ${test_source})
target_compile_definitions(${tester} PRIVATE "BOOST_TEST_DYN_LINK=1")
target_link_libraries(${tester} LINK_PRIVATE katja Boost::unit_test_framework)
add_test(NAME ${test_name} COMMAND ${tester})
endforeach()