2018-03-10 02:31:58 +08:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2018-04-20 23:11:55 +08:00
|
|
|
project (HDF5_CPP_TEST CXX)
|
|
|
|
|
2010-05-14 00:01:50 +08:00
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# Notes: When creating unit test executables they should be prefixed
|
|
|
|
# with "cpp_". This allows for easier filtering of the test suite when
|
|
|
|
# using ctest. An example would be
|
|
|
|
# ctest -R cpp_
|
|
|
|
# which would only run the C++ based unit tests.
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Define Sources
|
|
|
|
#-----------------------------------------------------------------------------
|
2016-05-04 23:06:05 +08:00
|
|
|
set (CPP_TEST_SOURCES
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/testhdf5.cpp
|
2016-01-15 23:57:00 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tarray.cpp
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tattr.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tcompound.cpp
|
2014-03-31 00:15:11 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tdspl.cpp
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tfile.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tfilter.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/th5s.cpp
|
2016-10-11 13:14:25 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/titerate.cpp
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tlinks.cpp
|
2014-04-07 22:11:13 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tobject.cpp
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/trefer.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/ttypes.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/tvlstr.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/dsets.cpp
|
|
|
|
${HDF5_CPP_TEST_SOURCE_DIR}/h5cpputil.cpp
|
|
|
|
)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Generate the H5srcdir_str.h file containing user settings needed by compilation
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
|
2014-03-12 06:07:13 +08:00
|
|
|
configure_file (${HDF5_CPP_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h @ONLY)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2016-05-04 23:06:05 +08:00
|
|
|
add_executable (cpp_testhdf5 ${CPP_TEST_SOURCES} )
|
2019-06-18 20:46:25 +08:00
|
|
|
target_include_directories (cpp_testhdf5 PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};${HDF5_TEST_BINARY_DIR};$<$<BOOL:${HDF5_ENABLE_PARALLEL}>:${MPI_C_INCLUDE_DIRS}>")
|
2018-04-27 05:41:04 +08:00
|
|
|
target_compile_definitions(cpp_testhdf5
|
2018-05-09 21:53:25 +08:00
|
|
|
PRIVATE $<$<BOOL:${HDF5_ENABLE_PARALLEL}>:MPICH_SKIP_MPICXX;MPICH_IGNORE_CXX_SEEK># Parallel/MPI, prevent spurious cpp/cxx warnings
|
2018-04-27 05:41:04 +08:00
|
|
|
)
|
2019-06-18 20:46:25 +08:00
|
|
|
if (NOT BUILD_SHARED_LIBS)
|
|
|
|
TARGET_C_PROPERTIES (cpp_testhdf5 STATIC)
|
|
|
|
target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIB_TARGET} ${HDF5_LIB_TARGET} ${HDF5_TEST_LIB_TARGET})
|
|
|
|
else ()
|
|
|
|
TARGET_C_PROPERTIES (cpp_testhdf5 SHARED)
|
|
|
|
target_link_libraries (cpp_testhdf5 PRIVATE ${HDF5_CPP_LIBSH_TARGET} ${HDF5_LIBSH_TARGET} ${HDF5_TEST_LIBSH_TARGET})
|
2019-07-19 05:27:06 +08:00
|
|
|
if (MINGW)
|
|
|
|
target_link_options (${HDF5_CPP_LIBSH_TARGET}
|
|
|
|
PRIVATE -static-libgcc -static-libstdc++
|
|
|
|
)
|
|
|
|
endif ()
|
2019-06-18 20:46:25 +08:00
|
|
|
endif ()
|
2018-04-27 05:41:04 +08:00
|
|
|
set_target_properties (cpp_testhdf5 PROPERTIES FOLDER test/cpp)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2020-01-16 01:38:06 +08:00
|
|
|
if (HDF5_TEST_CPP)
|
|
|
|
include (CMakeTests.cmake)
|
|
|
|
endif ()
|