Files
pip/tests/CMakeLists.txt
2021-01-21 13:20:02 +03:00

28 lines
1.0 KiB
CMake

include(DownloadGTest)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/suppr.txt ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
macro(pip_test NAME LIBS)
file(GLOB _CPPS "${NAME}/*.cpp")
file(GLOB _HDRS "${NAME}/*.h")
set(_target pip_${NAME}_test)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PIP_ROOT_BINARY_DIR}")
add_executable(${_target} ${_CPPS} ${_HDRS})
if (NOT WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(${_target} PRIVATE -fsanitize=address,undefined)
target_link_options(${_target} PRIVATE -fsanitize=address,undefined)
target_link_libraries(${_target} asan)
endif()
target_link_libraries(${_target} pip ${LIBS} gtest_main gmock_main)
add_test(NAME ${_target} COMMAND tests)
add_custom_target(${_target}_perform ALL
COMMAND ${CMAKE_COMMAND} -E env "LSAN_OPTIONS=suppressions=suppr.txt" $<TARGET_FILE:${_target}>)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY)
list(APPEND PIP_TESTS_LIST "${NAME}")
set(PIP_TESTS_LIST ${PIP_TESTS_LIST} PARENT_SCOPE)
endmacro()
pip_test(concurrent "")
pip_test(math "")
pip_test(core "")