summaryrefslogtreecommitdiffstats
path: root/hl/test/CMakeLists.txt
blob: 916dcf31318120cde3058d4df5406a6f4987bbed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required (VERSION 3.1.0)
PROJECT (HDF5_HL_TEST)
# --------------------------------------------------------------------
# Notes: When creating unit test executables they should be prefixed
# with "hl_". This allows for easier filtering of the test suite when
# using ctest. An example would be
#  ctest -R hl_
# which would only run the High Level based unit tests.
# --------------------------------------------------------------------

#-----------------------------------------------------------------------------
# Generate the H5srcdir_str.h file containing user settings needed by compilation
#-----------------------------------------------------------------------------
set (srcdir ${CMAKE_CURRENT_SOURCE_DIR})
configure_file (${HDF5_HL_TEST_SOURCE_DIR}/H5srcdir_str.h.in H5srcdir_str.h  @ONLY)

INCLUDE_DIRECTORIES (${CMAKE_CURRENT_BINARY_DIR})
INCLUDE_DIRECTORIES (${HDF5_TEST_SRC_DIR})

# --------------------------------------------------------------------
#  Macro used to add a unit test
# --------------------------------------------------------------------
MACRO (HL_ADD_EXE hl_name)
  add_executable (hl_${hl_name} ${hl_name}.c)
  TARGET_NAMING (hl_${hl_name} STATIC)
  TARGET_C_PROPERTIES (hl_${hl_name} STATIC " " " ")
  target_link_libraries (hl_${hl_name}
      ${HDF5_HL_LIB_TARGET}
      ${HDF5_LIB_TARGET}
      ${HDF5_TEST_LIB_TARGET}
  )
  set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
ENDMACRO (HL_ADD_EXE)

MACRO (HL_ADD_SHEXE hl_name)
  add_executable (hl_${hl_name} ${hl_name}.c)
  TARGET_NAMING (hl_${hl_name} SHARED)
  TARGET_C_PROPERTIES (hl_${hl_name} SHARED " " " ")
  target_link_libraries (hl_${hl_name}
      ${HDF5_HL_LIBSH_TARGET}
      ${HDF5_LIBSH_TARGET}
      ${HDF5_TEST_LIBSH_TARGET}
  )
  set_target_properties (hl_${hl_name} PROPERTIES FOLDER test/hl)
ENDMACRO (HL_ADD_SHEXE)

HL_ADD_EXE (test_ds)
HL_ADD_EXE (test_dset_opt)
HL_ADD_EXE (test_image)
HL_ADD_EXE (test_lite)
HL_ADD_EXE (test_packet)
HL_ADD_EXE (test_table)

# --------------------------------------------------------------------
# This executable is used to generate test files for the test_ds test.
# It should only be run during development when new test files are needed
# --------------------------------------------------------------------
if (HDF5_BUILD_GENERATORS)
  add_executable (hl_gen_test_ds gen_test_ds.c)
  TARGET_NAMING (hl_gen_test_ds STATIC)
  TARGET_C_PROPERTIES (hl_gen_test_ds STATIC " " " ")
  target_link_libraries (hl_gen_test_ds
      ${HDF5_HL_LIB_TARGET}
      ${HDF5_LIB_TARGET}
      ${HDF5_TEST_LIB_TARGET}
  )
  set_target_properties (hl_gen_test_ds PROPERTIES FOLDER test/hl/gen)
endif (HDF5_BUILD_GENERATORS)

include (CMakeTests.cmake)