2015-02-19 00:56:22 +08:00
|
|
|
cmake_minimum_required (VERSION 3.1.0)
|
2010-05-14 00:01:50 +08:00
|
|
|
PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Setup include Directories
|
|
|
|
#-----------------------------------------------------------------------------
|
2010-09-01 04:15:13 +08:00
|
|
|
INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SRC_DIR}/src)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add Test Lib
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
add_library (${HDF5_F90_C_TEST_LIB_TARGET} ${LIB_TYPE} t.c)
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_C_PROPERTIES (${HDF5_F90_C_TEST_LIB_TARGET} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (${HDF5_F90_C_TEST_LIB_TARGET}
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_C_LIB_TARGET}
|
|
|
|
${HDF5_TEST_LIB_TARGET}
|
|
|
|
)
|
|
|
|
H5_SET_LIB_OPTIONS (${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_NAME} ${LIB_TYPE})
|
2014-03-26 02:25:53 +08:00
|
|
|
set_target_properties (${HDF5_F90_C_TEST_LIB_TARGET} PROPERTIES
|
|
|
|
FOLDER libraries/test/fortran
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
|
|
|
|
)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2014-06-17 00:56:01 +08:00
|
|
|
# See if the F2008 intrinsic STORAGE_SIZE and C_SIZEOF are supported. If not then
|
|
|
|
# fall back to F2003. If F2003 not supported then use F90 for the tests.
|
|
|
|
|
2014-06-16 23:15:25 +08:00
|
|
|
if (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF)
|
|
|
|
add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F08.f90 tf.f90)
|
2014-06-17 00:56:01 +08:00
|
|
|
elseif (HDF5_ENABLE_F2003)
|
2014-06-16 23:15:25 +08:00
|
|
|
add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F03.f90 tf.f90)
|
2014-06-17 00:56:01 +08:00
|
|
|
else (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF)
|
|
|
|
add_library (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf_F90.f90 tf.f90)
|
2014-06-16 23:15:25 +08:00
|
|
|
endif (FORTRAN_HAVE_STORAGE_SIZE AND FORTRAN_HAVE_C_SIZEOF)
|
|
|
|
|
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
set (SHARED_LINK_FLAGS " ")
|
2014-04-03 02:35:01 +08:00
|
|
|
if (WIN32)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS BUILD_HDF5_DLL)
|
|
|
|
if (MSVC)
|
|
|
|
set (SHARED_LINK_FLAGS "/DLL")
|
|
|
|
endif (MSVC)
|
|
|
|
endif (BUILD_SHARED_LIBS)
|
|
|
|
set_property (TARGET ${HDF5_F90_TEST_LIB_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS)
|
2014-04-03 02:35:01 +08:00
|
|
|
endif (WIN32)
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} " " ${SHARED_LINK_FLAGS})
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
target_link_libraries (${HDF5_F90_TEST_LIB_TARGET}
|
2011-08-23 22:26:03 +08:00
|
|
|
${HDF5_F90_C_TEST_LIB_TARGET}
|
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2010-05-14 00:01:50 +08:00
|
|
|
H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} ${LIB_TYPE})
|
2014-03-26 02:25:53 +08:00
|
|
|
set_target_properties (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES
|
|
|
|
FOLDER libraries/test/fortran
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>"
|
|
|
|
)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Add Tests
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-- Adding test for testhdf5_fortran
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (testhdf5_fortran
|
2010-05-14 00:01:50 +08:00
|
|
|
fortranlib_test.f90
|
|
|
|
tH5A.f90
|
|
|
|
tH5D.f90
|
|
|
|
tH5E.f90
|
|
|
|
tH5F.f90
|
|
|
|
tH5G.f90
|
|
|
|
tH5I.f90
|
|
|
|
tH5P.f90
|
|
|
|
tH5R.f90
|
|
|
|
tH5S.f90
|
|
|
|
tH5Sselect.f90
|
|
|
|
tH5T.f90
|
|
|
|
tH5VL.f90
|
|
|
|
tH5Z.f90
|
2014-04-06 23:56:21 +08:00
|
|
|
tHDF5.f90
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (testhdf5_fortran ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (testhdf5_fortran " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (testhdf5_fortran
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_TEST_LIB_TARGET}
|
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND MSVC)
|
|
|
|
target_link_libraries (testhdf5_fortran "ws2_32.lib")
|
|
|
|
endif (WIN32 AND MSVC)
|
|
|
|
set_target_properties (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (testhdf5_fortran PROPERTIES FOLDER test/fortran)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
#-- Adding test for testhdf5_fortran_1_8
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (testhdf5_fortran_1_8
|
2010-05-14 00:01:50 +08:00
|
|
|
fortranlib_test_1_8.f90
|
|
|
|
tH5O.f90
|
|
|
|
tH5A_1_8.f90
|
|
|
|
tH5G_1_8.f90
|
2014-04-06 23:56:21 +08:00
|
|
|
tH5MISC_1_8.f90
|
|
|
|
tHDF5_1_8.f90
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (testhdf5_fortran_1_8 ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (testhdf5_fortran_1_8 " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (testhdf5_fortran_1_8
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_TEST_LIB_TARGET}
|
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND MSVC)
|
|
|
|
target_link_libraries (testhdf5_fortran_1_8 "ws2_32.lib")
|
|
|
|
endif (WIN32 AND MSVC)
|
|
|
|
set_target_properties (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (testhdf5_fortran_1_8 PROPERTIES FOLDER test/fortran)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2011-09-30 22:01:49 +08:00
|
|
|
#-- Adding test for fortranlib_test_F03
|
2014-03-12 05:14:57 +08:00
|
|
|
if (HDF5_ENABLE_F2003)
|
|
|
|
add_executable (fortranlib_test_F03
|
2011-09-30 22:01:49 +08:00
|
|
|
fortranlib_test_F03.f90
|
|
|
|
tH5E_F03.f90
|
2013-02-18 10:01:18 +08:00
|
|
|
tH5F_F03.f90
|
2011-09-30 22:01:49 +08:00
|
|
|
tH5L_F03.f90
|
2012-09-28 03:48:54 +08:00
|
|
|
tH5O_F03.f90
|
2011-09-30 22:01:49 +08:00
|
|
|
tH5P_F03.f90
|
|
|
|
tH5T_F03.f90
|
2014-04-06 23:56:21 +08:00
|
|
|
tHDF5_F03.f90
|
2011-09-30 22:01:49 +08:00
|
|
|
)
|
|
|
|
TARGET_NAMING (fortranlib_test_F03 ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (fortranlib_test_F03 " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (fortranlib_test_F03
|
2011-09-30 22:01:49 +08:00
|
|
|
${HDF5_F90_TEST_LIB_TARGET}
|
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND MSVC)
|
|
|
|
target_link_libraries (fortranlib_test_F03 "ws2_32.lib")
|
|
|
|
endif (WIN32 AND MSVC)
|
|
|
|
set_target_properties (fortranlib_test_F03 PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (fortranlib_test_F03 PROPERTIES FOLDER test/fortran)
|
|
|
|
endif (HDF5_ENABLE_F2003)
|
2011-09-30 22:01:49 +08:00
|
|
|
|
2010-05-14 00:01:50 +08:00
|
|
|
#-- Adding test for fflush1
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (fflush1 fflush1.f90)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (fflush1 ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (fflush1 " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (fflush1
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_F90_TEST_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND MSVC)
|
|
|
|
target_link_libraries (fflush1 "ws2_32.lib")
|
|
|
|
endif (WIN32 AND MSVC)
|
|
|
|
set_target_properties (fflush1 PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (fflush1 PROPERTIES FOLDER test/fortran)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
|
|
|
#-- Adding test for fflush2
|
2014-03-12 05:14:57 +08:00
|
|
|
add_executable (fflush2 fflush2.f90)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (fflush2 ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (fflush2 " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (fflush2
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_TEST_LIB_TARGET}
|
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND MSVC)
|
|
|
|
target_link_libraries (fflush2 "ws2_32.lib")
|
|
|
|
endif (WIN32 AND MSVC)
|
|
|
|
set_target_properties (fflush2 PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (fflush2 PROPERTIES FOLDER test/fortran)
|
2010-05-14 00:01:50 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
include (CMakeTests.cmake)
|