2015-02-19 00:56:22 +08:00
|
|
|
cmake_minimum_required (VERSION 3.1.0)
|
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
|
|
|
|
#-----------------------------------------------------------------------------
|
2015-03-26 06:08:46 +08:00
|
|
|
INCLUDE_DIRECTORIES (${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})
|
2015-03-26 06:08:46 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f90_ex_${example} ${LIB_TYPE} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
target_link_libraries (f90_ex_${example}
|
2010-05-14 00:01:50 +08:00
|
|
|
${HDF5_F90_LIB_TARGET}
|
|
|
|
${HDF5_LIB_TARGET}
|
|
|
|
)
|
2015-03-26 06:08:46 +08:00
|
|
|
target_include_directories (f90_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
|
|
|
|
set_target_properties (f90_ex_${example} PROPERTIES
|
|
|
|
LINKER_LANGUAGE Fortran
|
|
|
|
FOLDER examples/fortran
|
|
|
|
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
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})
|
2015-03-26 06:08:46 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f03_ex_${example} ${LIB_TYPE} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
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
|
|
|
)
|
2015-03-26 06:08:46 +08:00
|
|
|
target_include_directories (f03_ex_${example} PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
|
|
|
|
set_target_properties (f03_ex_${example} PROPERTIES
|
|
|
|
LINKER_LANGUAGE Fortran
|
|
|
|
FOLDER examples/fortran03
|
|
|
|
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
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})
|
2015-03-26 06:08:46 +08:00
|
|
|
TARGET_FORTRAN_PROPERTIES (f90_ex_ph5example ${LIB_TYPE} " " " ")
|
2014-03-12 05:14:57 +08:00
|
|
|
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
|
|
|
)
|
2015-03-26 06:08:46 +08:00
|
|
|
target_include_directories (f90_ex_ph5example PRIVATE ${CMAKE_Fortran_MODULE_DIRECTORY}/static)
|
|
|
|
set_target_properties (f90_ex_ph5example PROPERTIES
|
|
|
|
LINKER_LANGUAGE Fortran
|
|
|
|
FOLDER examples/fortran
|
|
|
|
Fortran_MODULE_DIRECTORY ${CMAKE_Fortran_MODULE_DIRECTORY}
|
|
|
|
)
|
2014-03-12 05:14:57 +08:00
|
|
|
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)
|