3
0
mirror of https://github.com/triqs/dft_tools synced 2024-07-17 16:33:46 +02:00
dft_tools/test/c++/CMakeLists.txt
Nils Wentzell f65e5bfbad Further cleanining, switching to static library
-Disable LINTing in test macros with comment // NOLINT
-Enable static analyzers for c++ tests
-Switch app4triqs_c to static library
 Dynamic was pickung up previously installed libapp4triqs_c.so in tests
 Also there is no need to be dynamic for applications
-Fix previous change in HeaderFilterRegex:
 'app4triqs/c++' was blocking all headers for clang-tidy checks.
 'app4triqs' works well, but we cannot install any other headers into
 app4triqs folder structure.
 We thus had to create INSTALL_DIR in travis.yml
2018-03-26 00:31:39 +02:00

29 lines
816 B
CMake

# Copy reference h5 files to binary dir
file(GLOB all_h5_files *.h5)
file(COPY ${all_h5_files} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
set(all_tests toto)
foreach(t ${all_tests})
add_executable(${t} ${CMAKE_CURRENT_SOURCE_DIR}/${t}.cpp)
target_link_libraries(${t} app4triqs_c gtest)
add_test(${t} ${CMAKE_CURRENT_BINARY_DIR}/${t})
# Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE)
set_target_properties(${t} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXECUTABLE}")
endif()
# Run cppcheck if found
if(CPPCHECK_EXECUTABLE)
add_custom_command(
TARGET ${t}
COMMAND ${CPPCHECK_EXECUTABLE}
--enable=warning,style,performance,portability
--std=c++14
--template=gcc
--verbose
--quiet
${CMAKE_CURRENT_SOURCE_DIR}/${t}.cpp
)
endif()
endforeach()