3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-23 04:43:42 +01:00

[cmake] Build gtest from test/c++/gtest and use gtest_main target

This commit is contained in:
Nils Wentzell 2019-09-06 15:56:24 -04:00
parent da55635d5c
commit 31433b69fb
2 changed files with 4 additions and 3 deletions

View File

@ -1,3 +1,6 @@
# Build googletest
add_subdirectory(gtest EXCLUDE_FROM_ALL)
# Copy h5 files to binary dir # Copy h5 files to binary dir
file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5) file(GLOB_RECURSE all_h5_ref_files RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.ref.h5)
foreach(file ${all_h5_ref_files}) foreach(file ${all_h5_ref_files})
@ -12,7 +15,7 @@ foreach(test ${all_tests})
get_filename_component(test_dir ${test} DIRECTORY) get_filename_component(test_dir ${test} DIRECTORY)
add_executable(${test_name} ${test}) add_executable(${test_name} ${test})
set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) set_property(TARGET ${test_name} PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
target_link_libraries(${test_name} app4triqs_c triqs::gtest project_warnings) target_link_libraries(${test_name} app4triqs_c gtest_main project_warnings)
add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir}) add_test(NAME ${test_name} COMMAND ${test_name} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_dir})
# Run clang-tidy if found # Run clang-tidy if found
if(CLANG_TIDY_EXECUTABLE) if(CLANG_TIDY_EXECUTABLE)

View File

@ -28,5 +28,3 @@ TEST(Toto, H5) { // NOLINT
EXPECT_EQ(a, a2); // NOLINT EXPECT_EQ(a, a2); // NOLINT
} }
MAKE_MAIN; // NOLINT