3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-18 20:12:53 +01:00
dft_tools/test/c++/CMakeLists.txt

33 lines
958 B
CMake
Raw Normal View History

# 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()
# List of all tests
set(all_tests toto)
foreach(test ${all_tests})
get_filename_component(test_name ${test} NAME_WE)
add_executable(${test_name} ${test})
target_link_libraries(${test_name} app4triqs_c triqs::gtest)
add_test(${test_name} ${test_name})
# Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE)
set_target_properties(${test_name} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
endif()
# Run cppcheck if found
if(CPPCHECK_EXECUTABLE)
add_custom_command(
TARGET ${test_name}
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,style,performance,portability
--std=c++14
--template=gcc
--verbose
--quiet
${CMAKE_CURRENT_SOURCE_DIR}/${test}.cpp
)
endif()
endforeach()