tests are using HDF5 explicitly, so link against HDF5

This commit is contained in:
Nico Schlömer 2014-10-08 12:50:55 +02:00
parent 89bec1cd8b
commit 9d6431a040
2 changed files with 14 additions and 2 deletions

View File

@ -997,7 +997,15 @@ ENDMACRO()
MACRO(add_bin_test prefix F)
ADD_EXECUTABLE(${prefix}_${F} ${F}.c)
TARGET_LINK_LIBRARIES(${prefix}_${F} netcdf)
# Some tests explicitly depend on HDF5, e.g., ncdump_tst_h_scalar.
# Some others depend on HDF5_HL, e.g., nc_test4_tst_interops.
# Hence, we have to link the tests against those libraries.
# TODO see if we can implement a more fine-grained approach
TARGET_LINK_LIBRARIES(${prefix}_${F}
netcdf
${HDF5_C_LIBRARIES}
${HDF5_HL_LIBRARIES}
)
IF(MSVC)
SET_TARGET_PROPERTIES(${prefix}_${F}
PROPERTIES LINK_FLAGS_DEBUG " /NODEFAULTLIB:MSVCRT"

View File

@ -5,7 +5,11 @@ FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
FOREACH(CTEST ${H5TESTS})
ADD_EXECUTABLE(${CTEST} ${CTEST}.c)
TARGET_LINK_LIBRARIES(${CTEST} netcdf)
TARGET_LINK_LIBRARIES(${CTEST}
netcdf
${HDF5_C_LIBRARIES}
${HDF5_HL_LIBRARIES}
)
ADD_TEST(${CTEST} ${EXECUTABLE_OUTPUT_PATH}/${CTEST})
ENDFOREACH()