summaryrefslogtreecommitdiffstats
path: root/fortran
diff options
context:
space:
mode:
authorAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
committerAllen Byrne <byrn@hdfgroup.org>2010-05-13 16:01:50 (GMT)
commitae06433ab0ca13838c2762c8fad165a041d64c42 (patch)
tree72d645731c00953c3daf6dad8a1cf0dc97326943 /fortran
parent940931aa853602b0b6edfd4ca1a6526fd7975dd2 (diff)
downloadhdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.zip
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.gz
hdf5-ae06433ab0ca13838c2762c8fad165a041d64c42.tar.bz2
[svn-r18793] Add files to support building library with CMake
Tested: Local linux
Diffstat (limited to 'fortran')
-rw-r--r--fortran/CMakeLists.txt142
-rw-r--r--fortran/examples/CMakeLists.txt61
-rw-r--r--fortran/src/CMakeLists.txt229
-rw-r--r--fortran/test/CMakeLists.txt175
4 files changed, 607 insertions, 0 deletions
diff --git a/fortran/CMakeLists.txt b/fortran/CMakeLists.txt
new file mode 100644
index 0000000..a649fab
--- /dev/null
+++ b/fortran/CMakeLists.txt
@@ -0,0 +1,142 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_F90 C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Detect name mangling convention used between Fortran and C
+#-----------------------------------------------------------------------------
+INCLUDE (FortranCInterface)
+FortranCInterface_HEADER (
+ ${HDF5_F90_BINARY_DIR}/FCMangle.h
+ MACRO_NAMESPACE "H5_FC_"
+ SYMBOL_NAMESPACE "H5_FC_"
+ SYMBOLS mysub mymod:my_sub
+)
+
+FILE (STRINGS ${HDF5_F90_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H5_FC_GLOBAL\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H5_FC_FUNC "H5_FC_FUNC(name,NAME) ${CMAKE_MATCH_1}" PARENT_SCOPE)
+
+FILE (STRINGS ${HDF5_F90_BINARY_DIR}/FCMangle.h CONTENTS REGEX "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)")
+STRING (REGEX MATCH "H5_FC_GLOBAL_\\(.*,.*\\) +(.*)" RESULT ${CONTENTS})
+SET (H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) ${CMAKE_MATCH_1}" PARENT_SCOPE)
+
+#-----------------------------------------------------------------------------
+# The provided CMake Fortran macros don't provide a general check function
+# so this one is used for a sizeof test.
+#-----------------------------------------------------------------------------
+MACRO (CHECK_FORTRAN_FEATURE FUNCTION CODE VARIABLE)
+ IF (NOT DEFINED ${VARIABLE})
+ MESSAGE (STATUS "Testing Fortran ${FUNCTION}")
+ IF (CMAKE_REQUIRED_LIBRARIES)
+ SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES
+ "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}")
+ ELSE (CMAKE_REQUIRED_LIBRARIES)
+ SET (CHECK_FUNCTION_EXISTS_ADD_LIBRARIES)
+ ENDIF (CMAKE_REQUIRED_LIBRARIES)
+ FILE (WRITE
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ "${CODE}"
+ )
+ TRY_COMPILE (${VARIABLE}
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f
+ CMAKE_FLAGS "${CHECK_FUNCTION_EXISTS_ADD_LIBRARIES}"
+ OUTPUT_VARIABLE OUTPUT
+ )
+
+# MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+# MESSAGE ( "Test result ${OUTPUT}")
+# MESSAGE ( "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * ")
+
+ IF (${VARIABLE})
+ SET (${VARIABLE} 1 CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+ MESSAGE (STATUS "Testing Fortran ${FUNCTION} - OK")
+ FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+ "Determining if the Fortran ${FUNCTION} exists passed with the following output:\n"
+ "${OUTPUT}\n\n"
+ )
+ ELSE (${VARIABLE})
+ MESSAGE (STATUS "Testing Fortran ${FUNCTION} - Fail")
+ SET (${VARIABLE} "" CACHE INTERNAL "Have Fortran function ${FUNCTION}")
+ FILE (APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Determining if the Fortran ${FUNCTION} exists failed with the following output:\n"
+ "${OUTPUT}\n\n")
+ ENDIF (${VARIABLE})
+ ENDIF (NOT DEFINED ${VARIABLE})
+ENDMACRO (CHECK_FORTRAN_FEATURE)
+
+#-----------------------------------------------------------------------------
+# Configure Checks which require Fortran compilation must go in here
+# not in the main ConfigureChecks.cmake files, because if the user has
+# no Fortran compiler, problems arise.
+#
+# Be careful with leading spaces here, do not remove them.
+#-----------------------------------------------------------------------------
+CHECK_FORTRAN_FEATURE(sizeof
+ "
+ PROGRAM main
+ i = sizeof(x)
+ END PROGRAM
+ "
+ FORTRAN_HAVE_SIZEOF
+)
+
+CHECK_FORTRAN_FEATURE(RealIsNotDouble
+ "
+ MODULE type_mod
+ INTERFACE h5t
+ MODULE PROCEDURE h5t_real
+ MODULE PROCEDURE h5t_dble
+ END INTERFACE
+ CONTAINS
+ SUBROUTINE h5t_real(r)
+ REAL :: r
+ END SUBROUTINE h5t_real
+ SUBROUTINE h5t_dble(d)
+ DOUBLE PRECISION :: d
+ END SUBROUTINE h5t_dble
+ END MODULE type_mod
+ PROGRAM main
+ USE type_mod
+ REAL :: r
+ DOUBLE PRECISION :: d
+ CALL h5t(r)
+ CALL h5t(d)
+ END PROGRAM main
+ "
+ FORTRAN_DEFAULT_REAL_NOT_DOUBLE
+)
+
+#-----------------------------------------------------------------------------
+# Make sure generated files and modules are picked up correctly
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES(
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+ )
+
+#-----------------------------------------------------------------------------
+# Traverse source subdirectory
+#-----------------------------------------------------------------------------
+ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/src ${HDF5_F90_BINARY_DIR}/src)
+
+#-----------------------------------------------------------------------------
+# When building utility executables we reuse these variables
+#-----------------------------------------------------------------------------
+#inherit EXE_EXT from parent HDF5 cmake project
+#inherit MAKE_SYSTEM from parent HDF5 cmake project
+#inherit CFG_INIT from parent HDF5 cmake project
+
+#-----------------------------------------------------------------------------
+# Build the Fortran Examples
+#-----------------------------------------------------------------------------
+IF (HDF5_BUILD_EXAMPLES)
+ ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/examples ${HDF5_F90_BINARY_DIR}/examples)
+ENDIF (HDF5_BUILD_EXAMPLES)
+
+#-----------------------------------------------------------------------------
+# Testing
+#-----------------------------------------------------------------------------
+IF (BUILD_TESTING)
+ ADD_SUBDIRECTORY (${HDF5_F90_SOURCE_DIR}/test ${HDF5_F90_BINARY_DIR}/test)
+ENDIF (BUILD_TESTING)
diff --git a/fortran/examples/CMakeLists.txt b/fortran/examples/CMakeLists.txt
new file mode 100644
index 0000000..00b76a4
--- /dev/null
+++ b/fortran/examples/CMakeLists.txt
@@ -0,0 +1,61 @@
+cmake_minimum_required (VERSION 2.8)
+# --------------------------------------------------------------------
+# Notes: When creating examples they should be prefixed
+# with "f90_ex_". This allows for easier filtering of the examples.
+# --------------------------------------------------------------------
+PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-----------------------------------------------------------------------------
+# Define Sources
+#-----------------------------------------------------------------------------
+SET (examples
+ dsetexample
+ fileexample
+ rwdsetexample
+ attrexample
+ groupexample
+ grpsexample
+ grpdsetexample
+ hyperslab
+ selectele
+ grpit
+ refobjexample
+ refregexample
+ mountexample
+ compound
+)
+
+FOREACH (example ${examples})
+ ADD_EXECUTABLE (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
+ H5_NAMING (f90_ex_${example})
+ IF (WIN32)
+ IF (BUILD_SHARED_LIBS)
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (f90_ex_${example}
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (MSVC)
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET f90_ex_${example}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ HDF5F90_WINDOWS
+ )
+ SET_TARGET_PROPERTIES (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
+ ENDIF (WIN32)
+ TARGET_LINK_LIBRARIES (f90_ex_${example}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+ )
+ENDFOREACH (example ${examples})
diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt
new file mode 100644
index 0000000..dc68891
--- /dev/null
+++ b/fortran/src/CMakeLists.txt
@@ -0,0 +1,229 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_F90_SRC C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# When building utility executables that generate other (source) files :
+# we make use of the following variables defined in the root CMakeLists.
+# Certain systems may add /Debug or /Release to output paths
+# and we need to call the executable from inside the CMake configuration
+#-----------------------------------------------------------------------------
+#inherit EXE_EXT from parent HDF5 cmake project
+#inherit CFG_INIT from parent HDF5 cmake project
+
+#-----------------------------------------------------------------------------
+# Setup the Fortran auto-detection utilities
+# H5test_kind(_SIZEOF).f90 used to generate H5fortran_detect.f90
+# H5fortran_detect.f90 used to generate H5fort_type_defines.h
+# H5fort_type_defines.h used to generate H5f90i_gen.h + H5fortran_types.f90
+#-----------------------------------------------------------------------------
+IF (FORTRAN_HAVE_SIZEOF)
+ ADD_EXECUTABLE (H5test_FortranHavekind
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind_SIZEOF.f90
+ )
+ELSE (FORTRAN_HAVE_SIZEOF)
+ ADD_EXECUTABLE (H5test_FortranHavekind
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5test_kind.f90
+ )
+ENDIF (FORTRAN_HAVE_SIZEOF)
+IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (H5test_FortranHavekind
+ PROPERTIES
+ COMPILE_FLAGS "/MT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (H5test_FortranHavekind
+ PROPERTIES
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (H5test_FortranHavekind PROPERTIES LINKER_LANGUAGE Fortran)
+
+SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5test_FortranHavekind${EXE_EXT})
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/H5fortran_detect.f90
+ COMMAND ${CMD}
+ ARGS > ${HDF5_F90_BINARY_DIR}/H5fortran_detect.f90
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS H5test_FortranHavekind
+)
+#-----------------------------------------------------------------------------
+ADD_EXECUTABLE (H5fortran_detect
+ ${HDF5_F90_BINARY_DIR}/H5fortran_detect.f90
+)
+IF (WIN32)
+ IF (MSVC)
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (H5fortran_detect
+ PROPERTIES
+ COMPILE_FLAGS "/MT"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (H5fortran_detect
+ PROPERTIES
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (H5test_FortranHavekind PROPERTIES LINKER_LANGUAGE Fortran)
+
+SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5fortran_detect${EXE_EXT})
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
+ COMMAND ${CMD}
+ ARGS > ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS H5fortran_detect
+)
+
+#-----------------------------------------------------------------------------
+ADD_EXECUTABLE (H5match_types
+ ${HDF5_F90_BINARY_DIR}/H5fort_type_defines.h
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5match_types.c
+)
+SET (CMD ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}${CFG_INIT}/H5match_types${EXE_EXT})
+ADD_CUSTOM_COMMAND (
+ OUTPUT ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
+ ${HDF5_F90_BINARY_DIR}/H5fortran_types.f90
+ COMMAND ${CMD}
+ WORKING_DIRECTORY ${HDF5_F90_BINARY_DIR}
+ DEPENDS H5match_types
+)
+
+#-----------------------------------------------------------------------------
+# f90CStub lib
+#-----------------------------------------------------------------------------
+SET (f90CStub_C_SRCS
+ # generated files
+ ${HDF5_F90_BINARY_DIR}/H5f90i_gen.h
+
+ # normal distribution
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5f90kit.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5_f.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Af.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Df.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Ef.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Ff.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Gf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5If.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Lf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Of.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Pf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Rf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Sf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Tf.c
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Zf.c
+)
+
+IF (H5_HAVE_PARALLEL)
+ SET (f90CStub_C_SRCS
+ ${f90CStub_C_SRCS}
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5FDmpiof.c
+ )
+ENDIF (H5_HAVE_PARALLEL)
+
+SET_SOURCE_FILES_PROPERTIES (${f90CStub_C_SRCS} PROPERTIES LANGUAGE C)
+
+ADD_LIBRARY (${HDF5_F90_C_LIB_TARGET} ${LIB_TYPE} ${f90CStub_C_SRCS})
+TARGET_LINK_LIBRARIES (${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_C_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (${HDF5_F90_C_LIB_TARGET} ${HDF5_F90_C_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Fortran Real Size
+#-----------------------------------------------------------------------------
+IF (FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
+ # default real is 4 bytes, so include double signatures
+ SET (F_DBLE "Include")
+ELSE (FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
+ # default real is 8 bytes, so exclude double signatures
+ SET (F_DBLE "Exclude")
+ENDIF (FORTRAN_DEFAULT_REAL_NOT_DOUBLE)
+
+#-----------------------------------------------------------------------------
+# Fortran Modules
+#-----------------------------------------------------------------------------
+SET (f90_F_SRCS
+ # generated files
+ ${HDF5_F90_BINARY_DIR}/H5fortran_types.f90
+
+ # normal distribution
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5f90global.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5_ff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Aff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Dff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Eff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Fff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Gff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Iff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Lff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Off.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Pff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Rff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Sff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Tff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5Zff.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5_DBLE_Interface${F_DBLE}.f90
+)
+
+#-----------------------------------------------------------------------------
+# Add H5FDMPIO if parallel
+#-----------------------------------------------------------------------------
+IF (H5_HAVE_PARALLEL)
+ SET (f90_F_SRCS
+ ${f90_F_SRCS}
+ ${HDF5_F90_SRC_SOURCE_DIR}/HDF5mpio.f90
+ ${HDF5_F90_SRC_SOURCE_DIR}/H5FDmpioff.f90
+ )
+ELSE (H5_HAVE_PARALLEL)
+ SET (f90_F_SRCS
+ ${f90_F_SRCS}
+ ${HDF5_F90_SRC_SOURCE_DIR}/HDF5.f90
+ )
+ENDIF (H5_HAVE_PARALLEL)
+
+#-----------------------------------------------------------------------------
+# Add Main fortran library
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF5_F90_LIB_TARGET} ${LIB_TYPE} ${f90_F_SRCS})
+IF (WIN32)
+ IF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET ${HDF5_F90_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ BUILD_HDF5_DLL
+ )
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET}
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL /DEF:${HDF5_F90_SRC_SOURCE_DIR}/hdf5_fortrandll.def"
+ )
+ ENDIF (MSVC)
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET ${HDF5_F90_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ HDF5F90_WINDOWS
+ )
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (${HDF5_F90_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_LINK_LIBRARIES (${HDF5_F90_LIB_TARGET} ${HDF5_F90_C_LIB_TARGET} ${HDF5_LIB_TARGET})
+SET_GLOBAL_VARIABLE (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_F90_LIB_TARGET}")
+H5_SET_LIB_OPTIONS (${HDF5_F90_LIB_TARGET} ${HDF5_F90_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add Target(s) to CMake Install for import into other projects
+#-----------------------------------------------------------------------------
+IF (HDF5_EXPORTED_TARGETS)
+ INSTALL (
+ TARGETS
+ ${HDF5_F90_C_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ EXPORT
+ ${HDF5_EXPORTED_TARGETS}
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+ RUNTIME DESTINATION bin
+ )
+ENDIF (HDF5_EXPORTED_TARGETS)
diff --git a/fortran/test/CMakeLists.txt b/fortran/test/CMakeLists.txt
new file mode 100644
index 0000000..ec75c95
--- /dev/null
+++ b/fortran/test/CMakeLists.txt
@@ -0,0 +1,175 @@
+cmake_minimum_required (VERSION 2.8)
+PROJECT (HDF5_FORTRAN_TESTS C CXX Fortran)
+
+#-----------------------------------------------------------------------------
+# Setup include Directories
+#-----------------------------------------------------------------------------
+INCLUDE_DIRECTORIES (${CMAKE_Fortran_MODULE_DIRECTORY} ${HDF5_F90_BINARY_DIR} ${HDF5_F90_SOURCE_DIR}/src)
+LINK_DIRECTORIES (
+ ${CMAKE_Fortran_MODULE_DIRECTORY}
+ ${HDF5_F90_BINARY_DIR}
+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
+)
+
+#-----------------------------------------------------------------------------
+# Add Test Lib
+#-----------------------------------------------------------------------------
+ADD_LIBRARY (${HDF5_F90_C_TEST_LIB_TARGET} ${LIB_TYPE} t.c)
+# Must explicity add a dependency here to force the generation of headers
+# which are created for ${HDF5_F90_C_LIB_TARGET}
+#ADD_DEPENDENCIES(${HDF5_F90_C_TEST_LIB_TARGET} ${HDF5_F90_LIB_TARGET} )
+TARGET_LINK_LIBRARIES (${HDF5_F90_C_TEST_LIB_TARGET}
+ ${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})
+
+ADD_LIBRARY (${HDF5_F90_TEST_LIB_TARGET} ${LIB_TYPE} tf.f90)
+# Must explicity add a dependency here to force the generation of headers
+# which are created for ${HDF5_F90_C_LIB_TARGET}
+ADD_DEPENDENCIES(${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_F90_C_TEST_LIB_TARGET}
+)
+IF (WIN32)
+ IF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ BUILD_HDF5_DLL
+ )
+ IF (MSVC)
+ SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET}
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE /DLL"
+ )
+ ENDIF (MSVC)
+ ENDIF (BUILD_SHARED_LIBS)
+ SET_PROPERTY (TARGET ${HDF5_F90_TEST_LIB_TARGET}
+ APPEND PROPERTY COMPILE_DEFINITIONS
+ HDF5F90_WINDOWS
+ )
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (${HDF5_F90_TEST_LIB_TARGET} PROPERTIES LINKER_LANGUAGE Fortran)
+TARGET_LINK_LIBRARIES (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_C_TEST_LIB_TARGET})
+H5_SET_LIB_OPTIONS (${HDF5_F90_TEST_LIB_TARGET} ${HDF5_F90_TEST_LIB_NAME} ${LIB_TYPE})
+
+#-----------------------------------------------------------------------------
+# Add Tests
+#-----------------------------------------------------------------------------
+
+#-- Adding test for testhdf5_fortran
+ADD_EXECUTABLE (testhdf5_fortran
+ 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
+)
+H5_NAMING (testhdf5_fortran)
+TARGET_LINK_LIBRARIES (testhdf5_fortran
+ ${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+)
+IF (WIN32)
+ IF (MSVC)
+ TARGET_LINK_LIBRARIES (testhdf5_fortran "ws2_32.lib")
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (testhdf5_fortran
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (testhdf5_fortran PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME testhdf5_fortran COMMAND $<TARGET_FILE:testhdf5_fortran>)
+
+#-- Adding test for testhdf5_fortran_1_8
+ADD_EXECUTABLE (testhdf5_fortran_1_8
+ fortranlib_test_1_8.f90
+ tH5F.f90
+ tH5O.f90
+ tH5A_1_8.f90
+ tH5G_1_8.f90
+)
+H5_NAMING (testhdf5_fortran_1_8)
+TARGET_LINK_LIBRARIES (testhdf5_fortran_1_8
+ ${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+)
+IF (WIN32)
+ IF (MSVC)
+ TARGET_LINK_LIBRARIES (testhdf5_fortran_1_8 "ws2_32.lib")
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (testhdf5_fortran_1_8
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (testhdf5_fortran_1_8 PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME testhdf5_fortran_1_8 COMMAND $<TARGET_FILE:testhdf5_fortran_1_8>)
+
+#-- Adding test for fflush1
+ADD_EXECUTABLE (fflush1 fflush1.f90)
+H5_NAMING (fflush1)
+TARGET_LINK_LIBRARIES (fflush1
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+)
+IF (WIN32)
+ IF (MSVC)
+ TARGET_LINK_LIBRARIES (fflush1 "ws2_32.lib")
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (fflush1
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (fflush1 PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME fflush1 COMMAND $<TARGET_FILE:fflush1>)
+
+#-- Adding test for fflush2
+ADD_EXECUTABLE (fflush2 fflush2.f90)
+H5_NAMING (fflush2)
+TARGET_LINK_LIBRARIES (fflush2
+ ${HDF5_F90_TEST_LIB_TARGET}
+ ${HDF5_F90_LIB_TARGET}
+ ${HDF5_LIB_TARGET}
+)
+IF (WIN32)
+ IF (MSVC)
+ TARGET_LINK_LIBRARIES (fflush2 "ws2_32.lib")
+ IF (BUILD_SHARED_LIBS)
+ SET_TARGET_PROPERTIES (fflush2
+ PROPERTIES
+ COMPILE_FLAGS "/dll"
+ LINK_FLAGS "/SUBSYSTEM:CONSOLE"
+ )
+ ENDIF (BUILD_SHARED_LIBS)
+ ENDIF (MSVC)
+ENDIF (WIN32)
+SET_TARGET_PROPERTIES (fflush2 PROPERTIES LINKER_LANGUAGE Fortran)
+
+ADD_TEST (NAME fflush2 COMMAND $<TARGET_FILE:fflush2>)