mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Factor out the zint_add_test macro
This commit is contained in:
parent
b69df5ad91
commit
3114a6697b
@ -8,6 +8,8 @@ project(zint_backend_tests)
|
|||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
|
include(${zint-package_SOURCE_DIR}/cmake/zint_add_test.cmake)
|
||||||
|
|
||||||
file(GLOB_RECURSE zint_backend_tests_data LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/*")
|
file(GLOB_RECURSE zint_backend_tests_data LIST_DIRECTORIES false RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "data/*")
|
||||||
foreach(data_file IN LISTS zint_backend_tests_data)
|
foreach(data_file IN LISTS zint_backend_tests_data)
|
||||||
configure_file(${data_file} ${data_file} COPYONLY)
|
configure_file(${data_file} ${data_file} COPYONLY)
|
||||||
@ -33,18 +35,6 @@ if(ZINT_STATIC)
|
|||||||
target_include_directories(testcommon-static PUBLIC ${zint_backend_tests_SOURCE_DIR})
|
target_include_directories(testcommon-static PUBLIC ${zint_backend_tests_SOURCE_DIR})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
macro(zint_add_test test_name test_command)
|
|
||||||
set(ADDITIONAL_LIBS "${ARGN}" ${LIBRARY_FLAGS})
|
|
||||||
add_executable(${test_command} ${test_command}.c)
|
|
||||||
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
|
|
||||||
add_test(${test_name} ${test_command})
|
|
||||||
if(ZINT_STATIC)
|
|
||||||
add_executable(${test_command}-static ${test_command}.c)
|
|
||||||
target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS})
|
|
||||||
add_test(${test_name}-static ${test_command}-static)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
zint_add_test(2of5 test_2of5)
|
zint_add_test(2of5 test_2of5)
|
||||||
zint_add_test(auspost test_auspost)
|
zint_add_test(auspost test_auspost)
|
||||||
zint_add_test(aztec test_aztec)
|
zint_add_test(aztec test_aztec)
|
||||||
|
16
cmake/zint_add_test.cmake
Normal file
16
cmake/zint_add_test.cmake
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
# Copyright (C) 2020 Robin Stuart <rstuart114@gmail.com>
|
||||||
|
# Adapted from qrencode/tests/CMakeLists.txt
|
||||||
|
# Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||||
|
# vim: set ts=4 sw=4 et :
|
||||||
|
|
||||||
|
macro(zint_add_test test_name test_command)
|
||||||
|
set(ADDITIONAL_LIBS "${ARGN}" ${LIBRARY_FLAGS})
|
||||||
|
add_executable(${test_command} ${test_command}.c)
|
||||||
|
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
|
||||||
|
add_test(${test_name} ${test_command})
|
||||||
|
if(ZINT_STATIC)
|
||||||
|
add_executable(${test_command}-static ${test_command}.c)
|
||||||
|
target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS})
|
||||||
|
add_test(${test_name}-static ${test_command}-static)
|
||||||
|
endif()
|
||||||
|
endmacro()
|
@ -8,16 +8,6 @@ project(zint_frontend_tests)
|
|||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
macro(zint_add_test test_name test_command)
|
include(${zint-package_SOURCE_DIR}/cmake/zint_add_test.cmake)
|
||||||
set(ADDITIONAL_LIBS "${ARGN}" ${LIBRARY_FLAGS})
|
|
||||||
add_executable(${test_command} ${test_command}.c)
|
|
||||||
target_link_libraries(${test_command} testcommon ${ADDITIONAL_LIBS})
|
|
||||||
add_test(${test_name} ${test_command})
|
|
||||||
if(ZINT_STATIC)
|
|
||||||
add_executable(${test_command}-static ${test_command}.c)
|
|
||||||
target_link_libraries(${test_command}-static testcommon-static ${ADDITIONAL_LIBS})
|
|
||||||
add_test(${test_name}-static ${test_command}-static)
|
|
||||||
endif()
|
|
||||||
endmacro()
|
|
||||||
|
|
||||||
zint_add_test(args test_args)
|
zint_add_test(args test_args)
|
||||||
|
Loading…
Reference in New Issue
Block a user