add hdf5 test build files

This commit is contained in:
Christian Zimmermann 2023-01-13 15:42:15 +01:00
parent 5dd114f03f
commit b6455049c4
3 changed files with 29 additions and 1 deletions

View file

@ -1,8 +1,17 @@
find_package(HDF5 REQUIRED COMPONENTS C HL)
if(HDF5_FOUND)
include_directories(${HDF5_INCLUDE_DIRS})
else()
message(FATAL_ERROR "HDF5 not found")
endif()
message(STATUS "hdf5 libs = ${HDF5_LIBRARIES}")
set(HDF5_LIBS ${HDF5_LIBRARIES} ${HDF5_HL_LIBRARIES})
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_subdirectory(lib)
#add_subdirectory(tests)
add_subdirectory(tests)
set(HDF5_INSTALL_PATH ${INSTALL_PATH}/hdf5)
install(DIRECTORY include/ DESTINATION ${HDF5_INSTALL_PATH}/include)

View file

@ -0,0 +1,11 @@
set(TEST_FILE_BASE "${CMAKE_CURRENT_BINARY_DIR}/test-file-")
message(STATUS "TEST_FILE_BASE = ${TEST_FILE_BASE}")
add_definitions(-DTEST_FILE_BASE=${TEST_FILE_BASE})
#add_test(NAME clean COMMAND rm -f ${TEST_FILE_BASE}*)
add_executable(h5basic h5_basic_unit_test.cc)
add_dependencies(h5basic cnorxz cnorxzhdf5)
target_link_libraries(h5basic ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${HDF5_LIBS} cnorxz cnorxzhdf5)
add_test(NAME h5basic COMMAND rm -f ${TEST_FILE_BASE}* ; h5basic)

View file

@ -0,0 +1,8 @@
// check no file
// check no hdf5 file
// check write to new file
// check read from that file
// check write to existing file
// check again read from that file