2019-04-03 00:07:03 +02:00
|
|
|
# Copy h5 files to binary dir
|
|
|
|
file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5)
|
|
|
|
foreach(file ${all_h5_ref_files})
|
|
|
|
configure_file(${file} ${file} COPYONLY)
|
|
|
|
endforeach()
|
2018-03-22 18:11:39 +01:00
|
|
|
|
2019-04-03 00:07:03 +02:00
|
|
|
# List of all tests
|
2019-08-20 20:32:21 +02:00
|
|
|
file(GLOB_RECURSE all_tests RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
|
2018-03-22 18:11:39 +01:00
|
|
|
|
2019-04-03 00:07:03 +02:00
|
|
|
foreach(test ${all_tests})
|
|
|
|
get_filename_component(test_name ${test} NAME_WE)
|
2019-07-31 17:07:48 +02:00
|
|
|
get_filename_component(test_dir ${test} DIRECTORY)
|
2019-04-03 00:07:03 +02:00
|
|
|
add_executable(${test_name} ${test})
|
2020-05-28 17:09:35 +02:00
|
|
|
target_link_libraries(${test_name} ${PROJECT_NAME}_c gtest_main ${PROJECT_NAME}_warnings)
|
2020-04-24 23:51:19 +02:00
|
|
|
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
2019-08-02 20:24:21 +02:00
|
|
|
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
|
2018-03-25 19:00:54 +02:00
|
|
|
# Run clang-tidy if found
|
2018-03-26 00:31:39 +02:00
|
|
|
if(CLANG_TIDY_EXECUTABLE)
|
2019-04-03 00:07:03 +02:00
|
|
|
set_target_properties(${test_name} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
|
2018-03-26 00:31:39 +02:00
|
|
|
endif()
|
|
|
|
# Run cppcheck if found
|
|
|
|
if(CPPCHECK_EXECUTABLE)
|
|
|
|
add_custom_command(
|
2019-04-03 00:07:03 +02:00
|
|
|
TARGET ${test_name}
|
2018-03-26 00:31:39 +02:00
|
|
|
COMMAND ${CPPCHECK_EXECUTABLE}
|
|
|
|
--enable=warning,style,performance,portability
|
2019-09-24 23:50:38 +02:00
|
|
|
--std=c++17
|
2018-03-26 00:31:39 +02:00
|
|
|
--template=gcc
|
|
|
|
--verbose
|
2019-11-21 17:54:10 +01:00
|
|
|
--force
|
2018-03-26 00:31:39 +02:00
|
|
|
--quiet
|
2019-11-21 17:54:10 +01:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/${test}
|
2018-03-26 00:31:39 +02:00
|
|
|
)
|
|
|
|
endif()
|
2018-03-22 18:11:39 +01:00
|
|
|
endforeach()
|