2023-03-23 19:07:31 +00:00
|
|
|
macro(unit_tests)
|
|
|
|
set(oneValueArgs MODULE_NAME)
|
|
|
|
set(multiValueArgs FILES DEPENDENCIES)
|
|
|
|
cmake_parse_arguments(UNIT_TESTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
|
|
|
|
|
|
|
set(TARGET_NAME ${UNIT_TESTS_MODULE_NAME}_unit_tests)
|
|
|
|
add_executable(${TARGET_NAME} ${CMAKE_SOURCE_DIR}/test/test_runner.cpp ${UNIT_TESTS_FILES})
|
|
|
|
target_link_libraries(${TARGET_NAME} PUBLIC test_utils ${UNIT_TESTS_DEPENDENCIES})
|
|
|
|
|
|
|
|
set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER test/${UNIT_TESTS_MODULE_NAME})
|
|
|
|
|
|
|
|
set(UNIT_TEST_TARGETS ${UNIT_TEST_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
|
|
|
|
endmacro()
|
|
|
|
|
|
|
|
macro(integration_tests)
|
|
|
|
set(oneValueArgs MODULE_NAME)
|
|
|
|
set(multiValueArgs FILES FILES_UNIX FILES_WINDOWS DEPENDENCIES)
|
|
|
|
cmake_parse_arguments(UNIT_TESTS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
|
|
|
|
2023-09-24 11:33:38 +00:00
|
|
|
set(TARGET_NAME ${UNIT_TESTS_MODULE_NAME}_integration_tests)
|
2023-03-23 19:07:31 +00:00
|
|
|
|
|
|
|
set(PLATFORM_FILES)
|
|
|
|
if(UNIX)
|
2023-09-24 11:33:38 +00:00
|
|
|
list(APPEND PLATFORM_FILES ${UNIT_TESTS_UNIX_FILES})
|
2023-03-23 19:07:31 +00:00
|
|
|
elseif(WIN32)
|
2023-09-24 11:33:38 +00:00
|
|
|
list(APPEND PLATFORM_FILES ${UNIT_TESTS_WIN32_FILES})
|
2023-03-23 19:07:31 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
add_executable(${TARGET_NAME} ${CMAKE_SOURCE_DIR}/test/test_runner.cpp
|
|
|
|
${UNIT_TESTS_FILES}
|
|
|
|
${PLATFORM_FILES}
|
|
|
|
)
|
|
|
|
target_link_libraries(${TARGET_NAME} PUBLIC test_utils ${UNIT_TESTS_DEPENDENCIES})
|
|
|
|
|
|
|
|
set_property(TARGET ${TARGET_NAME} PROPERTY FOLDER test/${UNIT_TESTS_MODULE_NAME})
|
|
|
|
|
|
|
|
set(UNIT_TEST_TARGETS ${UNIT_TEST_TARGETS} ${TARGET_NAME} PARENT_SCOPE)
|
2023-09-24 11:33:38 +00:00
|
|
|
endmacro()
|