2013-01-15 02:35:30 +08:00
|
|
|
cmake_minimum_required (VERSION 2.8.10)
|
2010-09-01 04:15:13 +08:00
|
|
|
PROJECT (HDF5_F90_EXAMPLES C CXX Fortran)
|
2010-05-14 00:01:50 +08:00
|
|
|
# --------------------------------------------------------------------
|
|
|
|
# Notes: When creating examples they should be prefixed
|
|
|
|
# with "f90_ex_". This allows for easier filtering of the examples.
|
|
|
|
# --------------------------------------------------------------------
|
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# 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
|
|
|
|
|
|
|
#-----------------------------------------------------------------------------
|
|
|
|
# Define Sources
|
|
|
|
#-----------------------------------------------------------------------------
|
2014-03-12 05:14:57 +08:00
|
|
|
set (examples
|
2012-12-16 06:59:00 +08:00
|
|
|
h5_cmprss
|
2012-12-11 06:41:13 +08:00
|
|
|
h5_crtdat
|
|
|
|
h5_rdwt
|
|
|
|
h5_crtatt
|
|
|
|
h5_crtgrp
|
|
|
|
h5_crtgrpar
|
|
|
|
h5_crtgrpd
|
|
|
|
h5_extend
|
|
|
|
h5_subset
|
2010-05-14 00:01:50 +08:00
|
|
|
hyperslab
|
|
|
|
selectele
|
|
|
|
refobjexample
|
|
|
|
refregexample
|
|
|
|
mountexample
|
|
|
|
compound
|
|
|
|
)
|
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
set (F2003_examples
|
2011-09-27 22:17:27 +08:00
|
|
|
rwdset_fortran2003
|
|
|
|
nested_derived_type
|
|
|
|
compound_fortran2003
|
|
|
|
compound_complex_fortran2003
|
|
|
|
)
|
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
foreach (example ${examples})
|
|
|
|
add_executable (f90_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (f90_ex_${example} ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f90_ex_${example} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND NOT CYGWIN)
|
|
|
|
set_property (TARGET f90_ex_${example}
|
2010-05-14 00:01:50 +08:00
|
|
|
APPEND PROPERTY COMPILE_DEFINITIONS
|
2011-09-27 22:17:27 +08:00
|
|
|
HDF5F90_WINDOWS
|
2010-05-14 00:01:50 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
endif (WIN32 AND NOT CYGWIN)
|
|
|
|
target_link_libraries (f90_ex_${example}
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (f90_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (f90_ex_${example} PROPERTIES FOLDER examples/fortran)
|
|
|
|
endforeach (example ${examples})
|
2010-09-01 04:15:13 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
if (HDF5_ENABLE_F2003)
|
|
|
|
foreach (example ${F2003_examples})
|
|
|
|
add_executable (f03_ex_${example} ${HDF5_F90_EXAMPLES_SOURCE_DIR}/${example}.f90)
|
2011-11-05 01:31:32 +08:00
|
|
|
TARGET_NAMING (f03_ex_${example} ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f03_ex_${example} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND NOT CYGWIN)
|
|
|
|
set_property (TARGET f03_ex_${example}
|
2011-09-30 22:01:49 +08:00
|
|
|
APPEND PROPERTY COMPILE_DEFINITIONS HDF5F90_WINDOWS
|
2011-11-05 01:31:32 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
endif (WIN32 AND NOT CYGWIN)
|
|
|
|
target_link_libraries (f03_ex_${example}
|
2011-11-05 01:31:32 +08:00
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
2011-09-27 22:17:27 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (f03_ex_${example} PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (f03_ex_${example} PROPERTIES FOLDER examples/fortran03)
|
|
|
|
endforeach (example ${F2003_examples})
|
|
|
|
endif (HDF5_ENABLE_F2003)
|
2011-09-27 22:17:27 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
if (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
|
|
|
|
add_executable (f90_ex_ph5example ${HDF5_F90_EXAMPLES_SOURCE_DIR}/ph5example.f90)
|
2011-02-25 03:43:07 +08:00
|
|
|
TARGET_NAMING (f90_ex_ph5example ${LIB_TYPE})
|
2013-06-11 01:46:48 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
if (WIN32 AND NOT CYGWIN)
|
|
|
|
set_property (TARGET f90_ex_ph5example
|
2010-09-01 04:15:13 +08:00
|
|
|
APPEND PROPERTY COMPILE_DEFINITIONS
|
|
|
|
HDF5F90_WINDOWS
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
endif (WIN32 AND NOT CYGWIN)
|
|
|
|
target_link_libraries (f90_ex_ph5example
|
2010-09-01 04:15:13 +08:00
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
2011-11-04 05:06:37 +08:00
|
|
|
${MPI_Fortran_LIBRARIES}
|
2010-09-01 04:15:13 +08:00
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
set_target_properties (f90_ex_ph5example PROPERTIES LINKER_LANGUAGE Fortran)
|
|
|
|
set_target_properties (f90_ex_ph5example PROPERTIES FOLDER examples/fortran)
|
|
|
|
endif (H5_HAVE_PARALLEL AND MPI_Fortran_FOUND)
|
2013-08-20 05:49:44 +08:00
|
|
|
|
2014-03-12 05:14:57 +08:00
|
|
|
if (BUILD_TESTING)
|
|
|
|
include (CMakeTests.cmake)
|
|
|
|
endif (BUILD_TESTING)
|