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 C CXX )
#-----------------------------------------------------------------------------
# Instructions for use : Normal Build
#
# For standard build of HDF5 libraries,tests and tools.
# Run cmake using the HDF5 source tree to generate a build tree.
# Enable/Disable options according to requirements and
# set CMAKE_INSTALL_PREFIX to the required install path.
# Make install can be used to install all components for system-wide use.
#
2015-04-23 23:41:22 +08:00
if ( "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}" )
MESSAGE ( FATAL_ERROR "\nERROR! ${PROJECT_NAME} DOES NOT SUPPORT IN SOURCE BUILDS!\n"
" C M A K E _ C U R R E N T _ S O U R C E _ D I R = $ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } "
" = = C M A K E _ C U R R E N T _ B I N A R Y _ D I R = $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } \ n "
" N E X T S T E P S : \ n "
" ( 1 ) D e l e t e t h e C M a k e C a c h e . t x t f i l e a n d t h e C M a k e F i l e s / d i r e c t o r y \ n "
" u n d e r t h e s o u r c e d i r e c t o r y f o r $ { P R O J E C T _ N A M E } , o t h e r w i s e y o u \ n "
" w i l l n o t b e a b l e t o c o n f i g u r e $ { P R O J E C T _ N A M E } c o r r e c t l y ! \ n "
" * F o r e x a m p l e , o n l i n u x m a c h i n e s d o : \ n "
" $ r m - r C M a k e C a c h e . t x t C M a k e F i l e s / \ n "
" ( 2 ) C r e a t e a d i f f e r e n t d i r e c t o r y a n d c o n f i g u r e $ { P R O J E C T _ N A M E } i n t h a t d i r e c t o r y . \ n "
" * F o r e x a m p l e , o n l i n u x m a c h i n e s d o : \ n "
" $ m k d i r M Y _ B U I L D \ n "
" $ c d M Y _ B U I L D \ n "
" $ c m a k e [ O P T I O N S ] . . \ n "
)
endif ( )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Instructions for use : Sub-Project Build
#
# To include HDF5 as a sub-project within another project.
# Set HDF5_EXTERNALLY_CONFIGURED to 1 in the parent project and
# supply values for the following variables...
#
# HDF5_EXPORTED_TARGETS :
# Set this to the name of the targets variable which controls exports
# If unset (because parent project does not support/use the
2014-03-12 05:14:57 +08:00
# install (EXPORT target...) syntax), then targets are not configured
2010-05-14 00:01:50 +08:00
# for export during install.
#
# HDF5_LIB_DEPENDENCIES :
# If the build of HDF5 libs is being customized, then rules for the
# dependencies of the HDF5 libs may be 'incomplete', add additional
# dependencies to this variable so that external projects pick them up
#
# HDF5_EXTERNAL_LIB_PREFIX :
2015-05-15 00:51:20 +08:00
# If the parent project needs to install hdf libraries, but avoid
2010-05-14 00:01:50 +08:00
# name conflicts with system versions, then a prefix may be added
# to ensure that the correct versions configured are used.
#
2010-12-09 04:55:25 +08:00
# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR, HDF5_INSTALL_DATA_DIR :
# Customize the 'bin', 'lib', 'include', and 'share' installation directories.
2010-08-20 23:37:50 +08:00
#
# HDF5_INSTALL_NO_DEVELOPMENT :
# Set to true to skip installation of headers and CMake package files.
#
2010-05-14 00:01:50 +08:00
# Consider this example from the ParaView project, it builds its own zlib
# library and tells HDF5 to add it as a dependency - this ensures that
# any project making use of this build of HDF5 will use the correct zlib
#
# # Tell hdf5 that we are manually overriding certain settings
2014-03-12 05:14:57 +08:00
# set (HDF5_EXTERNALLY_CONFIGURED 1)
2010-05-14 00:01:50 +08:00
# # Avoid duplicating names of installed libraries
2014-03-12 05:14:57 +08:00
# set (HDF5_EXTERNAL_LIB_PREFIX "vtk")
2010-05-14 00:01:50 +08:00
# # Export configuration to this export variable
2014-03-12 05:14:57 +08:00
# set (HDF5_EXPORTED_TARGETS "paraview-targets")
2010-05-14 00:01:50 +08:00
#
# # Setup all necessary overrides for zlib so that HDF5 uses our
# # internally compiled zlib rather than any other version
2014-03-19 00:21:46 +08:00
# if (HDF5_ENABLE_Z_LIB_SUPPORT)
2015-05-15 00:51:20 +08:00
# # We must tell the main HDF5 library that it depends on our zlib
# set (HDF5_LIB_DEPENDENCIES vtkzlib)
2010-05-14 00:01:50 +08:00
# # Override the zlib header file
2014-03-19 00:21:46 +08:00
# if (VTK_USE_SYSTEM_ZLIB)
2014-03-12 05:14:57 +08:00
# set (H5_ZLIB_HEADER "zlib.h")
2014-03-19 00:21:46 +08:00
# else (VTK_USE_SYSTEM_ZLIB)
2014-03-12 05:14:57 +08:00
# set (H5_ZLIB_HEADER "vtk_zlib.h")
2010-05-14 00:01:50 +08:00
# # Set vars that FindZlib would have set if used in sub project
2014-03-12 05:14:57 +08:00
# set (ZLIB_INCLUDE_DIRS "${VTK_ZLIB_INCLUDE_DIRS}")
# set (ZLIB_LIBRARIES vtkzlib)
2014-03-19 00:21:46 +08:00
# endif (VTK_USE_SYSTEM_ZLIB)
# endif (HDF5_ENABLE_Z_LIB_SUPPORT)
2015-05-15 00:51:20 +08:00
#
2010-05-14 00:01:50 +08:00
# # Add the sub project
2014-03-19 00:21:46 +08:00
# add_subdirectory (Utilities/hdf5-1.8)
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
2015-08-06 05:01:07 +08:00
string ( TIMESTAMP CONFIG_DATE "%Y-%m-%d" )
2011-10-26 00:52:58 +08:00
#-----------------------------------------------------------------------------
# Allow Visual Studio solution directories
#-----------------------------------------------------------------------------
# Provide a way for Visual Studio Express users to turn OFF the new FOLDER
# organization feature. Default to ON for non-Express users. Express users must
# explicitly turn off this option to build HDF5 in the Express IDE...
#
2014-03-12 05:14:57 +08:00
option ( HDF5_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON )
2014-03-19 00:21:46 +08:00
mark_as_advanced ( HDF5_USE_FOLDERS )
2014-03-12 05:14:57 +08:00
if ( HDF5_USE_FOLDERS )
set_property ( GLOBAL PROPERTY USE_FOLDERS ON )
endif ( HDF5_USE_FOLDERS )
option ( HDF5_NO_PACKAGES "CPACK - Disable packaging" OFF )
2014-03-19 00:21:46 +08:00
mark_as_advanced ( HDF5_NO_PACKAGES )
2015-08-27 00:48:42 +08:00
option ( ALLOW_UNSUPPORTED "Allow unsupported combinations of configure options" OFF )
mark_as_advanced ( ALLOW_UNSUPPORTED )
2011-10-26 00:52:58 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Set the core names of all the libraries
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
set ( HDF5_LIB_CORENAME "hdf5" )
set ( HDF5_TEST_LIB_CORENAME "hdf5_test" )
set ( HDF5_CPP_LIB_CORENAME "hdf5_cpp" )
set ( HDF5_HL_LIB_CORENAME "hdf5_hl" )
set ( HDF5_HL_CPP_LIB_CORENAME "hdf5_hl_cpp" )
set ( HDF5_TOOLS_LIB_CORENAME "hdf5_tools" )
set ( HDF5_F90_LIB_CORENAME "hdf5_fortran" )
set ( HDF5_F90_C_LIB_CORENAME "hdf5_f90cstub" )
set ( HDF5_F90_TEST_LIB_CORENAME "hdf5_test_fortran" )
set ( HDF5_F90_C_TEST_LIB_CORENAME "hdf5_test_f90cstub" )
set ( HDF5_HL_F90_LIB_CORENAME "hdf5_hl_fortran" )
set ( HDF5_HL_F90_C_LIB_CORENAME "hdf5_hl_f90cstub" )
2016-02-29 10:43:00 +08:00
set ( HDF5_JAVA_JNI_LIB_CORENAME "hdf5_java" )
set ( HDF5_JAVA_HDF5_LIB_CORENAME "jarhdf5" )
set ( HDF5_JAVA_TEST_LIB_CORENAME "jartest5" )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Set the true names of all the libraries if customized by external project
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
set ( HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_LIB_CORENAME}" )
set ( HDF5_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TEST_LIB_CORENAME}" )
set ( HDF5_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_CPP_LIB_CORENAME}" )
set ( HDF5_HL_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_LIB_CORENAME}" )
set ( HDF5_HL_CPP_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_CPP_LIB_CORENAME}" )
set ( HDF5_TOOLS_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_TOOLS_LIB_CORENAME}" )
set ( HDF5_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_LIB_CORENAME}" )
set ( HDF5_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_LIB_CORENAME}" )
set ( HDF5_F90_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_TEST_LIB_CORENAME}" )
set ( HDF5_F90_C_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_F90_C_TEST_LIB_CORENAME}" )
set ( HDF5_HL_F90_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_LIB_CORENAME}" )
set ( HDF5_HL_F90_C_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_HL_F90_C_LIB_CORENAME}" )
2016-02-29 10:43:00 +08:00
set ( HDF5_JAVA_JNI_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_JNI_LIB_CORENAME}" )
set ( HDF5_JAVA_HDF5_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_HDF5_LIB_CORENAME}" )
set ( HDF5_JAVA_TEST_LIB_NAME "${HDF5_EXTERNAL_LIB_PREFIX}${HDF5_JAVA_TEST_LIB_CORENAME}" )
2010-05-14 00:01:50 +08:00
2010-07-21 22:00:47 +08:00
#-----------------------------------------------------------------------------
# Set the target names of all the libraries
#-----------------------------------------------------------------------------
2015-08-06 05:01:07 +08:00
set ( HDF5_LIB_TARGET "${HDF5_LIB_CORENAME}-static" )
set ( HDF5_TEST_LIB_TARGET "${HDF5_TEST_LIB_CORENAME}-static" )
set ( HDF5_CPP_LIB_TARGET "${HDF5_CPP_LIB_CORENAME}-static" )
set ( HDF5_HL_LIB_TARGET "${HDF5_HL_LIB_CORENAME}-static" )
set ( HDF5_HL_CPP_LIB_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-static" )
set ( HDF5_TOOLS_LIB_TARGET "${HDF5_TOOLS_LIB_CORENAME}-static" )
set ( HDF5_F90_LIB_TARGET "${HDF5_F90_LIB_CORENAME}-static" )
set ( HDF5_F90_C_LIB_TARGET "${HDF5_F90_C_LIB_CORENAME}-static" )
set ( HDF5_F90_TEST_LIB_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-static" )
set ( HDF5_F90_C_TEST_LIB_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-static" )
set ( HDF5_HL_F90_LIB_TARGET "${HDF5_HL_F90_LIB_CORENAME}-static" )
set ( HDF5_HL_F90_C_LIB_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-static" )
2016-02-29 10:43:00 +08:00
set ( HDF5_JAVA_JNI_LIB_TARGET "${HDF5_JAVA_JNI_LIB_CORENAME}" )
set ( HDF5_JAVA_HDF5_LIB_TARGET "${HDF5_JAVA_HDF5_LIB_CORENAME}" )
set ( HDF5_JAVA_TEST_LIB_TARGET "${HDF5_JAVA_TEST_LIB_CORENAME}" )
2015-08-06 05:01:07 +08:00
set ( HDF5_LIBSH_TARGET "${HDF5_LIB_CORENAME}-shared" )
set ( HDF5_TEST_LIBSH_TARGET "${HDF5_TEST_LIB_CORENAME}-shared" )
set ( HDF5_CPP_LIBSH_TARGET "${HDF5_CPP_LIB_CORENAME}-shared" )
set ( HDF5_HL_LIBSH_TARGET "${HDF5_HL_LIB_CORENAME}-shared" )
set ( HDF5_HL_CPP_LIBSH_TARGET "${HDF5_HL_CPP_LIB_CORENAME}-shared" )
set ( HDF5_TOOLS_LIBSH_TARGET "${HDF5_TOOLS_LIB_CORENAME}-shared" )
set ( HDF5_F90_LIBSH_TARGET "${HDF5_F90_LIB_CORENAME}-shared" )
set ( HDF5_F90_C_LIBSH_TARGET "${HDF5_F90_C_LIB_CORENAME}-shared" )
set ( HDF5_F90_TEST_LIBSH_TARGET "${HDF5_F90_TEST_LIB_CORENAME}-shared" )
set ( HDF5_F90_C_TEST_LIBSH_TARGET "${HDF5_F90_C_TEST_LIB_CORENAME}-shared" )
set ( HDF5_HL_F90_LIBSH_TARGET "${HDF5_HL_F90_LIB_CORENAME}-shared" )
set ( HDF5_HL_F90_C_LIBSH_TARGET "${HDF5_HL_F90_C_LIB_CORENAME}-shared" )
2010-07-21 22:00:47 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Define some CMake variables for use later in the project
#-----------------------------------------------------------------------------
2014-05-15 03:50:28 +08:00
set ( HDF_RESOURCES_DIR ${ HDF5_SOURCE_DIR } /config/cmake )
set ( HDF_RESOURCES_EXT_DIR ${ HDF5_SOURCE_DIR } /config/cmake_ext_mod )
2014-03-12 05:14:57 +08:00
set ( HDF5_SRC_DIR ${ HDF5_SOURCE_DIR } /src )
set ( HDF5_TEST_SRC_DIR ${ HDF5_SOURCE_DIR } /test )
set ( HDF5_CPP_SRC_DIR ${ HDF5_SOURCE_DIR } /c++ )
set ( HDF5_CPP_TST_DIR ${ HDF5_SOURCE_DIR } /c++/test )
set ( HDF5_HL_SRC_DIR ${ HDF5_SOURCE_DIR } /hl )
set ( HDF5_HL_CPP_SRC_DIR ${ HDF5_SOURCE_DIR } /hl/c++ )
set ( HDF5_TOOLS_SRC_DIR ${ HDF5_SOURCE_DIR } /tools )
2014-12-18 07:07:24 +08:00
set ( HDF5_PERFORM_SRC_DIR ${ HDF5_SOURCE_DIR } /tools/perform )
2014-03-12 05:14:57 +08:00
set ( HDF5_F90_SRC_DIR ${ HDF5_SOURCE_DIR } /fortran )
2016-02-29 10:43:00 +08:00
set ( HDF5_JAVA_JNI_SRC_DIR ${ HDF5_SOURCE_DIR } /java/src/jni )
set ( HDF5_JAVA_HDF5_SRC_DIR ${ HDF5_SOURCE_DIR } /java/src/hdf )
set ( HDF5_JAVA_TEST_SRC_DIR ${ HDF5_SOURCE_DIR } /java/test )
set ( HDF5_JAVA_LIB_DIR ${ HDF5_SOURCE_DIR } /java/lib )
set ( HDF5_JAVA_LOGGING_JAR ${ HDF5_SOURCE_DIR } /java/lib/slf4j-api-1.7.5.jar )
set ( HDF5_JAVA_LOGGING_NOP_JAR ${ HDF5_SOURCE_DIR } /java/lib/ext/slf4j-nop-1.7.5.jar )
set ( HDF5_JAVA_LOGGING_SIMPLE_JAR ${ HDF5_SOURCE_DIR } /java/lib/ext/slf4j-simple-1.7.5.jar )
if ( APPLE )
option ( HDF5_BUILD_FRAMEWORKS "TRUE to build as frameworks libraries, FALSE to build according to BUILD_SHARED_LIBS" FALSE )
endif ( APPLE )
2014-03-12 05:14:57 +08:00
if ( NOT HDF5_INSTALL_BIN_DIR )
set ( HDF5_INSTALL_BIN_DIR bin )
endif ( NOT HDF5_INSTALL_BIN_DIR )
if ( NOT HDF5_INSTALL_LIB_DIR )
2015-07-10 00:56:16 +08:00
if ( APPLE )
2016-02-29 10:43:00 +08:00
if ( HDF5_BUILD_FRAMEWORKS )
set ( HDF5_INSTALL_JAR_DIR ../Java )
else ( HDF5_BUILD_FRAMEWORKS )
set ( HDF5_INSTALL_JAR_DIR lib )
endif ( HDF5_BUILD_FRAMEWORKS )
2015-07-10 00:56:16 +08:00
set ( HDF5_INSTALL_FMWK_DIR ${ CMAKE_INSTALL_FRAMEWORK_PREFIX } )
2016-02-29 10:43:00 +08:00
else ( APPLE )
set ( HDF5_INSTALL_JAR_DIR lib )
2015-07-10 00:56:16 +08:00
endif ( APPLE )
2014-03-12 05:14:57 +08:00
set ( HDF5_INSTALL_LIB_DIR lib )
endif ( NOT HDF5_INSTALL_LIB_DIR )
if ( NOT HDF5_INSTALL_INCLUDE_DIR )
set ( HDF5_INSTALL_INCLUDE_DIR include )
endif ( NOT HDF5_INSTALL_INCLUDE_DIR )
if ( NOT HDF5_INSTALL_DATA_DIR )
if ( NOT WIN32 )
2015-07-10 00:56:16 +08:00
if ( APPLE )
if ( HDF5_BUILD_FRAMEWORKS )
set ( HDF5_INSTALL_EXTRA_DIR ../SharedSupport )
else ( HDF5_BUILD_FRAMEWORKS )
set ( HDF5_INSTALL_EXTRA_DIR share )
endif ( HDF5_BUILD_FRAMEWORKS )
set ( HDF5_INSTALL_FWRK_DIR ${ CMAKE_INSTALL_FRAMEWORK_PREFIX } )
endif ( APPLE )
2014-03-12 05:14:57 +08:00
set ( HDF5_INSTALL_DATA_DIR share )
set ( HDF5_INSTALL_CMAKE_DIR share/cmake )
else ( NOT WIN32 )
set ( HDF5_INSTALL_DATA_DIR "." )
set ( HDF5_INSTALL_CMAKE_DIR cmake )
endif ( NOT WIN32 )
endif ( NOT HDF5_INSTALL_DATA_DIR )
2010-08-20 23:37:50 +08:00
2015-09-25 03:14:44 +08:00
if ( DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}" )
set ( CMAKE_PREFIX_PATH ${ ADDITIONAL_CMAKE_PREFIX_PATH } ${ CMAKE_PREFIX_PATH } )
endif ( DEFINED ADDITIONAL_CMAKE_PREFIX_PATH AND EXISTS "${ADDITIONAL_CMAKE_PREFIX_PATH}" )
2010-07-21 22:00:47 +08:00
#-----------------------------------------------------------------------------
# parse the full version number from H5public.h and include in H5_VERS_INFO
#-----------------------------------------------------------------------------
2014-03-19 00:21:46 +08:00
file ( READ ${ HDF5_SRC_DIR } /H5public.h _h5public_h_contents )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*#define[ \t]+H5_VERS_MAJOR[ \t]+([0-9]*).*$"
2010-07-21 22:00:47 +08:00
" \ \ 1 " H 5 _ V E R S _ M A J O R $ { _ h 5 p u b l i c _ h _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*#define[ \t]+H5_VERS_MINOR[ \t]+([0-9]*).*$"
2010-07-21 22:00:47 +08:00
" \ \ 1 " H 5 _ V E R S _ M I N O R $ { _ h 5 p u b l i c _ h _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*#define[ \t]+H5_VERS_RELEASE[ \t]+([0-9]*).*$"
2010-07-21 22:00:47 +08:00
" \ \ 1 " H 5 _ V E R S _ R E L E A S E $ { _ h 5 p u b l i c _ h _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*#define[ \t]+H5_VERS_SUBRELEASE[ \t]+\" ( [0-9A-Za-z._]* ) \".*$"
2012-05-22 05:32:21 +08:00
" \ \ 1 " H 5 _ V E R S _ S U B R E L E A S E $ { _ h 5 p u b l i c _ h _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
#message (STATUS "VERSION: ${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}-${H5_VERS_SUBRELEASE}")
2010-07-21 22:00:47 +08:00
2011-05-25 22:57:16 +08:00
#-----------------------------------------------------------------------------
# parse the full soversion number from config/lt_vers.am and include in H5_SOVERS_INFO
#-----------------------------------------------------------------------------
2014-03-19 00:21:46 +08:00
file ( READ ${ HDF5_SOURCE_DIR } /config/lt_vers.am _lt_vers_am_contents )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*LT_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
2013-10-15 00:43:16 +08:00
" \ \ 1 " H 5 _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*LT_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
2011-05-25 22:57:16 +08:00
" \ \ 1 " H 5 _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
2014-03-12 05:14:57 +08:00
string ( REGEX REPLACE ".*LT_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
2011-05-25 22:57:16 +08:00
" \ \ 1 " H 5 _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
2014-03-19 00:21:46 +08:00
MATH ( EXPR H5_SOVERS_MAJOR ${ H5_SOVERS_INTERFACE } - ${ H5_SOVERS_RELEASE } )
2014-03-12 05:14:57 +08:00
message ( STATUS "SOVERSION: ${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
2016-02-29 10:43:00 +08:00
string ( REGEX MATCH ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_TOOLS_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_TOOLS_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_TOOLS_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ T O O L S _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_TOOLS_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ T O O L S _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_TOOLS_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ T O O L S _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_TOOLS_SOVERS_MAJOR ${ H5_TOOLS_SOVERS_INTERFACE } - ${ H5_TOOLS_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_TOOLS: ${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_CXX_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_CXX_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ C X X _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ C X X _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ C X X _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_CXX_SOVERS_MAJOR ${ H5_CXX_SOVERS_INTERFACE } - ${ H5_CXX_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_CXX: ${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_F_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_F_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ F _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ F _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ F _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_F_SOVERS_MAJOR ${ H5_F_SOVERS_INTERFACE } - ${ H5_F_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_F: ${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_HL_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_HL_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_HL_SOVERS_MAJOR ${ H5_HL_SOVERS_INTERFACE } - ${ H5_HL_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_HL: ${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_CXX_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_HL_CXX_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_HL_CXX_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ C X X _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_CXX_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ C X X _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_CXX_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ C X X _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_HL_CXX_SOVERS_MAJOR ${ H5_HL_CXX_SOVERS_INTERFACE } - ${ H5_HL_CXX_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_HL_CXX: ${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_HL_F_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_HL_F_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_HL_F_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ F _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_F_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ F _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_HL_F_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ H L _ F _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_HL_F_SOVERS_MAJOR ${ H5_HL_F_SOVERS_INTERFACE } - ${ H5_HL_F_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_HL_F: ${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}" )
endif ( )
string ( REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$" H5_JAVA_SOVERS_EXISTS ${ _lt_vers_am_contents } )
if ( H5_JAVA_SOVERS_EXISTS )
string ( REGEX REPLACE ".*LT_JAVA_VERS_INTERFACE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ J A V A _ S O V E R S _ I N T E R F A C E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_JAVA_VERS_REVISION[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ J A V A _ S O V E R S _ M I N O R $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
string ( REGEX REPLACE ".*LT_JAVA_VERS_AGE[ \t]+=[ \t]+([0-9]*).*$"
" \ \ 1 " H 5 _ J A V A _ S O V E R S _ R E L E A S E $ { _ l t _ v e r s _ a m _ c o n t e n t s } )
MATH ( EXPR H5_JAVA_SOVERS_MAJOR ${ H5_JAVA_SOVERS_INTERFACE } - ${ H5_JAVA_SOVERS_RELEASE } )
message ( STATUS "SOVERSION_JAVA: ${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}" )
endif ( )
2011-05-25 22:57:16 +08:00
2010-07-21 22:00:47 +08:00
#-----------------------------------------------------------------------------
# Basic HDF5 stuff here
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
set ( HDF5_PACKAGE "hdf5" )
set ( HDF5_PACKAGE_NAME "HDF5" )
set ( HDF5_PACKAGE_VERSION "${H5_VERS_MAJOR}.${H5_VERS_MINOR}.${H5_VERS_RELEASE}" )
set ( HDF5_PACKAGE_VERSION_MAJOR "${H5_VERS_MAJOR}.${H5_VERS_MINOR}" )
set ( HDF5_PACKAGE_VERSION_MINOR "${H5_VERS_RELEASE}" )
if ( NOT "${H5_VERS_SUBRELEASE}" STREQUAL "" )
set ( HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}-${H5_VERS_SUBRELEASE}" )
else ( NOT "${H5_VERS_SUBRELEASE}" STREQUAL "" )
set ( HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}" )
endif ( NOT "${H5_VERS_SUBRELEASE}" STREQUAL "" )
set ( HDF5_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
2016-02-29 10:43:00 +08:00
if ( H5_TOOLS_SOVERS_EXISTS )
set ( HDF5_TOOLS_PACKAGE_SOVERSION "${H5_TOOLS_SOVERS_MAJOR}.${H5_TOOLS_SOVERS_RELEASE}.${H5_TOOLS_SOVERS_MINOR}" )
else ( )
set ( HDF5_TOOLS_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_CXX_SOVERS_EXISTS )
set ( HDF5_CXX_PACKAGE_SOVERSION "${H5_CXX_SOVERS_MAJOR}.${H5_CXX_SOVERS_RELEASE}.${H5_CXX_SOVERS_MINOR}" )
else ( )
set ( HDF5_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_F_SOVERS_EXISTS )
set ( HDF5_F_PACKAGE_SOVERSION "${H5_F_SOVERS_MAJOR}.${H5_F_SOVERS_RELEASE}.${H5_F_SOVERS_MINOR}" )
else ( )
set ( HDF5_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_HL_SOVERS_EXISTS )
set ( HDF5_HL_PACKAGE_SOVERSION "${H5_HL_SOVERS_MAJOR}.${H5_HL_SOVERS_RELEASE}.${H5_HL_SOVERS_MINOR}" )
else ( )
set ( HDF5_HL_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_HL_F_SOVERS_EXISTS )
set ( HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_HL_CXX_SOVERS_MAJOR}.${H5_HL_CXX_SOVERS_RELEASE}.${H5_HL_CXX_SOVERS_MINOR}" )
else ( )
set ( HDF5_HL_CXX_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_HL_F_SOVERS_EXISTS )
set ( HDF5_HL_F_PACKAGE_SOVERSION "${H5_HL_F_SOVERS_MAJOR}.${H5_HL_F_SOVERS_RELEASE}.${H5_HL_F_SOVERS_MINOR}" )
else ( )
set ( HDF5_HL_F_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
if ( H5_JAVA_SOVERS_EXISTS )
set ( HDF5_PACKAGE_SOVERSION "${H5_JAVA_SOVERS_MAJOR}.${H5_JAVA_SOVERS_RELEASE}.${H5_JAVA_SOVERS_MINOR}" )
else ( )
set ( HDF5_JAVA_PACKAGE_SOVERSION "${H5_SOVERS_MAJOR}.${H5_SOVERS_RELEASE}.${H5_SOVERS_MINOR}" )
endif ( )
2014-03-12 05:14:57 +08:00
set ( HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}" )
set ( HDF5_PACKAGE_TARNAME "${HDF5_PACKAGE}${HDF_PACKAGE_EXT}" )
set ( HDF5_PACKAGE_URL "http://www.hdfgroup.org" )
set ( HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org" )
2010-07-21 22:00:47 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Include some macros for reusable code
#-----------------------------------------------------------------------------
2014-05-15 03:50:28 +08:00
include ( ${ HDF_RESOURCES_EXT_DIR } /HDFMacros.cmake )
include ( ${ HDF_RESOURCES_EXT_DIR } /HDFLibMacros.cmake )
include ( ${ HDF_RESOURCES_DIR } /HDF5Macros.cmake )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Setup output Directories
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
if ( NOT HDF5_EXTERNALLY_CONFIGURED )
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY
2010-05-14 00:01:50 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / b i n C A C H E P A T H " S i n g l e D i r e c t o r y f o r a l l E x e c u t a b l e s . "
)
2014-03-12 05:14:57 +08:00
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY
2010-05-14 00:01:50 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / b i n C A C H E P A T H " S i n g l e D i r e c t o r y f o r a l l L i b r a r i e s "
)
2014-03-12 05:14:57 +08:00
set ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY
2010-05-14 00:01:50 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / b i n C A C H E P A T H " S i n g l e D i r e c t o r y f o r a l l s t a t i c l i b r a r i e s . "
)
2014-03-12 05:14:57 +08:00
set ( CMAKE_Fortran_MODULE_DIRECTORY
2014-03-25 05:00:34 +08:00
$ { P R O J E C T _ B I N A R Y _ D I R } / b i n C A C H E P A T H " S i n g l e D i r e c t o r y f o r a l l f o r t r a n m o d u l e s . "
2010-05-14 00:01:50 +08:00
)
2016-02-29 10:43:00 +08:00
if ( WIN32 )
set ( CMAKE_TEST_OUTPUT_DIRECTORY ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } / ${ CMAKE_BUILD_TYPE } )
else ( WIN32 )
set ( CMAKE_TEST_OUTPUT_DIRECTORY ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } )
endif ( WIN32 )
2014-03-12 05:14:57 +08:00
else ( NOT HDF5_EXTERNALLY_CONFIGURED )
2010-05-14 00:01:50 +08:00
# if we are externally configured, but the project uses old cmake scripts
# this may not be set and utilities like H5detect will fail
2014-03-12 05:14:57 +08:00
if ( NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY )
set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${ EXECUTABLE_OUTPUT_PATH } )
endif ( NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY )
endif ( NOT HDF5_EXTERNALLY_CONFIGURED )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Targets built within this project are exported at Install time for use
2015-05-15 00:51:20 +08:00
# by other projects using FindHDF5.
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
if ( NOT HDF5_EXPORTED_TARGETS )
set ( HDF5_EXPORTED_TARGETS "hdf5-targets" )
endif ( NOT HDF5_EXPORTED_TARGETS )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# To include a library in the list exported by the project AT BUILD TIME,
# add it to this variable. This is NOT used by Make Install, but for projects
# which include hdf5 as a sub-project within their build tree
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
set_global_variable ( HDF5_LIBRARIES_TO_EXPORT "" )
set ( EXTERNAL_HEADER_LIST "" )
set ( EXTERNAL_LIBRARY_LIST "" )
set ( EXTERNAL_LIBRARYDLL_LIST "" )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Run all the CMake configuration tests for our build environment
#-----------------------------------------------------------------------------
2014-05-15 03:50:28 +08:00
include ( ${ HDF_RESOURCES_DIR } /ConfigureChecks.cmake )
2014-03-12 05:14:57 +08:00
set ( CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON )
2010-05-14 00:01:50 +08:00
2015-07-10 00:56:16 +08:00
#-----------------------------------------------------------------------------
# Mac OS X Options
#-----------------------------------------------------------------------------
if ( HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS )
set ( BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries" )
endif ( HDF5_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
2015-08-06 05:01:07 +08:00
# Option to Build Shared and Static libs, default is static
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
2015-08-06 05:01:07 +08:00
option ( BUILD_SHARED_LIBS "Build Shared Libraries" ON )
2014-03-12 05:14:57 +08:00
set ( H5_ENABLE_SHARED_LIB NO )
if ( BUILD_SHARED_LIBS )
set ( H5_ENABLE_SHARED_LIB YES )
2015-08-06 05:01:07 +08:00
set ( LINK_SHARED_LIBS ${ LINK_LIBS } )
2014-03-12 05:14:57 +08:00
endif ( BUILD_SHARED_LIBS )
2015-08-06 05:01:07 +08:00
set ( H5_ENABLE_STATIC_LIB YES )
2015-03-26 06:08:46 +08:00
set ( CMAKE_POSITION_INDEPENDENT_CODE ON )
2010-05-14 00:01:50 +08:00
2011-02-22 22:55:04 +08:00
#-----------------------------------------------------------------------------
# Option to Build Static executables
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( BUILD_STATIC_EXECS "Build Static Executabless" OFF )
if ( BUILD_STATIC_EXECS )
if ( NOT WIN32 )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static" )
endif ( NOT WIN32 )
endif ( BUILD_STATIC_EXECS )
2011-02-22 22:55:04 +08:00
2010-06-23 03:04:20 +08:00
#-----------------------------------------------------------------------------
# Option to use code coverage
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF )
if ( HDF5_ENABLE_COVERAGE )
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage" )
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage" )
2015-05-15 00:51:20 +08:00
set ( LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage" )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_COVERAGE )
2010-06-23 03:04:20 +08:00
2012-06-05 01:05:02 +08:00
#-----------------------------------------------------------------------------
# Option to indicate using dmalloc
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
# option (HDF5_ENABLE_USING_DMALLOC "Indicate that dmalloc is used" OFF)
# if (HDF5_ENABLE_USING_DMALLOC)
2014-03-19 00:21:46 +08:00
# find_package (DMALLOC)
2015-05-15 00:51:20 +08:00
# set (H5_HAVE_DMALLOC DMALLOC_FOUND)
2014-03-12 05:14:57 +08:00
# endif (HDF5_ENABLE_USING_DMALLOC)
2012-06-05 01:05:02 +08:00
2010-10-08 00:05:41 +08:00
#-----------------------------------------------------------------------------
# Option to indicate using a memory checker
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF )
if ( HDF5_ENABLE_USING_MEMCHECKER )
2015-05-15 00:51:20 +08:00
set ( H5_USING_MEMCHECKER 1 )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_USING_MEMCHECKER )
2010-10-08 00:05:41 +08:00
2016-01-04 06:06:52 +08:00
#-----------------------------------------------------------------------------
# Option to indicate internal memory allocation sanity checks are enabled
#-----------------------------------------------------------------------------
option ( HDF5_MEMORY_ALLOC_SANITY_CHECK "Indicate that internal memory allocation sanity checks are enabled" OFF )
if ( HDF5_MEMORY_ALLOC_SANITY_CHECK )
set ( H5_MEMORY_ALLOC_SANITY_CHECK 1 )
endif ( HDF5_MEMORY_ALLOC_SANITY_CHECK )
2010-11-17 00:38:40 +08:00
#-----------------------------------------------------------------------------
# Option to use deprecated public API symbols
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON )
if ( HDF5_ENABLE_DEPRECATED_SYMBOLS )
2015-05-15 00:51:20 +08:00
set ( H5_NO_DEPRECATED_SYMBOLS 0 )
2014-03-12 05:14:57 +08:00
else ( HDF5_ENABLE_DEPRECATED_SYMBOLS )
2015-05-15 00:51:20 +08:00
set ( H5_NO_DEPRECATED_SYMBOLS 1 )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_DEPRECATED_SYMBOLS )
2010-11-17 00:38:40 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# 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
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
set ( EXE_EXT "" )
if ( WIN32 )
set ( EXE_EXT ".exe" )
if ( NOT CYGWIN )
add_definitions ( -D_BIND_TO_CURRENT_VCLIBS_VERSION=1 )
add_definitions ( -D_CRT_SECURE_NO_WARNINGS )
add_definitions ( -D_CONSOLE )
endif ( NOT CYGWIN )
endif ( WIN32 )
if ( MSVC )
set ( CMAKE_MFC_FLAG 0 )
set ( WIN_COMPILE_FLAGS "" )
set ( WIN_LINK_FLAGS "" )
endif ( MSVC )
set ( MAKE_SYSTEM )
if ( CMAKE_BUILD_TOOL MATCHES "make" )
set ( MAKE_SYSTEM 1 )
endif ( CMAKE_BUILD_TOOL MATCHES "make" )
set ( CFG_INIT "/${CMAKE_CFG_INTDIR}" )
if ( MAKE_SYSTEM )
set ( CFG_INIT "" )
endif ( MAKE_SYSTEM )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Add some definitions for Debug Builds
#-----------------------------------------------------------------------------
2015-03-18 02:59:19 +08:00
option ( HDF5_ENABLE_TRACE "Enable API tracing capability" OFF )
mark_as_advanced ( HDF5_ENABLE_TRACE )
2014-03-12 05:14:57 +08:00
if ( CMAKE_BUILD_TYPE MATCHES Debug )
add_definitions ( -DDEBUG )
2012-06-05 01:05:02 +08:00
# Enable tracing of the API
2014-03-12 05:14:57 +08:00
if ( HDF5_ENABLE_TRACE )
add_definitions ( -DH5_DEBUG_API )
endif ( HDF5_ENABLE_TRACE )
2012-06-05 01:05:02 +08:00
# Enable instrumenting of the library's internal operations
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_INSTRUMENT "Instrument The library" OFF )
if ( HDF5_ENABLE_INSTRUMENT )
set ( H5_HAVE_INSTRUMENTED_LIBRARY 1 )
endif ( HDF5_ENABLE_INSTRUMENT )
2015-03-18 02:59:19 +08:00
mark_as_advanced ( HDF5_ENABLE_INSTRUMENT )
2014-03-12 05:14:57 +08:00
else ( CMAKE_BUILD_TYPE MATCHES Debug )
add_definitions ( -DNDEBUG )
if ( HDF5_ENABLE_TRACE )
add_definitions ( -DH5_DEBUG_API )
endif ( HDF5_ENABLE_TRACE )
endif ( CMAKE_BUILD_TYPE MATCHES Debug )
2010-05-14 00:01:50 +08:00
2011-08-19 04:59:00 +08:00
#-----------------------------------------------------------------------------
# Option to embed library info into executables
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_EMBEDDED_LIBINFO "embed library info into executables" ON )
if ( HDF5_ENABLE_EMBEDDED_LIBINFO )
set ( H5_HAVE_EMBEDDED_LIBINFO 1 )
endif ( HDF5_ENABLE_EMBEDDED_LIBINFO )
2011-08-19 04:59:00 +08:00
2015-05-15 00:51:20 +08:00
include ( ${ HDF_RESOURCES_DIR } /HDFCompilerFlags.cmake )
2010-05-14 00:01:50 +08:00
2010-06-15 03:08:23 +08:00
#-----------------------------------------------------------------------------
# All libs/tests/examples need the main include directories
#-----------------------------------------------------------------------------
2012-08-03 01:57:54 +08:00
INCLUDE_DIRECTORIES ( ${ HDF5_BINARY_DIR } ${ HDF5_SRC_DIR } ${ CMAKE_RUNTIME_OUTPUT_DIRECTORY } )
2010-06-15 03:08:23 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Option to Enable MPI Parallel
#-----------------------------------------------------------------------------
2014-05-15 03:50:28 +08:00
set ( CMAKE_MODULE_PATH ${ HDF_RESOURCES_DIR } ${ HDF_RESOURCES_EXT_DIR } ${ CMAKE_MODULE_PATH } )
2014-03-12 05:14:57 +08:00
option ( HDF5_ENABLE_PARALLEL "Enable parallel build (requires MPI)" OFF )
if ( HDF5_ENABLE_PARALLEL )
2014-03-28 04:32:47 +08:00
include ( FindMPI )
2011-11-03 04:39:31 +08:00
INCLUDE_DIRECTORIES ( ${ MPI_C_INCLUDE_PATH } )
2014-03-12 05:14:57 +08:00
if ( MPI_C_FOUND )
set ( H5_HAVE_PARALLEL 1 )
2011-11-03 04:39:31 +08:00
# MPI checks, only do these if MPI_C_FOUND is true, otherwise they always fail
2010-05-26 00:00:56 +08:00
# and once set, they are cached as false and not regenerated
2014-03-12 05:14:57 +08:00
set ( CMAKE_REQUIRED_LIBRARIES "${MPI_C_LIBRARIES}" )
2010-05-26 00:00:56 +08:00
# Used by Fortran + MPI
2011-11-03 04:39:31 +08:00
CHECK_SYMBOL_EXISTS ( MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Comm )
CHECK_SYMBOL_EXISTS ( MPI_Info_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" H5_HAVE_MPI_MULTI_LANG_Info )
2014-03-12 05:14:57 +08:00
else ( MPI_C_FOUND )
message ( STATUS "Parallel libraries not found" )
endif ( MPI_C_FOUND )
endif ( HDF5_ENABLE_PARALLEL )
2010-05-14 00:01:50 +08:00
# Parallel IO usage requires MPI to be Linked and Included
2014-03-12 05:14:57 +08:00
if ( H5_HAVE_PARALLEL )
set ( LINK_LIBS ${ LINK_LIBS } ${ MPI_C_LIBRARIES } )
2015-08-06 05:01:07 +08:00
set ( LINK_SHARED_LIBS ${ LINK_SHARED_LIBS } ${ MPI_C_LIBRARIES } )
2014-03-12 05:14:57 +08:00
if ( MPI_C_LINK_FLAGS )
set ( CMAKE_EXE_LINKER_FLAGS "${MPI_C_LINK_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}" )
endif ( MPI_C_LINK_FLAGS )
endif ( H5_HAVE_PARALLEL )
2010-05-14 00:01:50 +08:00
2014-03-12 05:14:57 +08:00
set ( DEFAULT_API_VERSION "v110" )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Option to use 1.6.x API
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_USE_16_API_DEFAULT "Use the HDF5 1.6.x API by default" OFF )
set ( H5_USE_16_API_DEFAULT 0 )
if ( HDF5_USE_16_API_DEFAULT )
set ( H5_USE_16_API_DEFAULT 1 )
set ( DEFAULT_API_VERSION "v16" )
endif ( HDF5_USE_16_API_DEFAULT )
2010-05-14 00:01:50 +08:00
2011-08-04 23:21:15 +08:00
#-----------------------------------------------------------------------------
# Option to use 1.8.x API
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_USE_18_API_DEFAULT "Use the HDF5 1.8.x API by default" OFF )
set ( H5_USE_18_API_DEFAULT 0 )
if ( HDF5_USE_18_API_DEFAULT )
set ( H5_USE_18_API_DEFAULT 1 )
set ( DEFAULT_API_VERSION "v18" )
endif ( HDF5_USE_18_API_DEFAULT )
2011-08-04 23:21:15 +08:00
2013-06-11 01:46:48 +08:00
#-----------------------------------------------------------------------------
# Include user macros
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
include ( UserMacros.cmake )
2013-06-11 01:46:48 +08:00
2015-03-18 02:59:19 +08:00
#-----------------------------------------------------------------------------
# Include filter (zlib, szip, etc.) macros
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
include ( CMakeFilters.cmake )
2010-05-14 00:01:50 +08:00
2010-09-03 05:00:43 +08:00
#-----------------------------------------------------------------------------
# Option for external libraries on windows
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
option ( HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF )
if ( NOT HDF5_EXTERNALLY_CONFIGURED )
if ( HDF5_PACKAGE_EXTLIBS )
set ( HDF5_NO_PACKAGES OFF CACHE BOOL "CPACK - Disable packaging" FORCE )
if ( HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND )
2011-12-21 00:11:07 +08:00
PACKAGE_ZLIB_LIBRARY ( ${ HDF5_ALLOW_EXTERNAL_SUPPORT } )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND )
2015-05-15 00:51:20 +08:00
2014-03-12 05:14:57 +08:00
if ( HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND )
2011-12-21 00:11:07 +08:00
PACKAGE_SZIP_LIBRARY ( ${ HDF5_ALLOW_EXTERNAL_SUPPORT } )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND )
endif ( HDF5_PACKAGE_EXTLIBS )
endif ( NOT HDF5_EXTERNALLY_CONFIGURED )
2010-09-11 00:15:34 +08:00
#-----------------------------------------------------------------------------
# Option to use threadsafe
#-----------------------------------------------------------------------------
2015-10-27 04:09:22 +08:00
option ( HDF5_ENABLE_THREADSAFE "Enable thread-safety" OFF )
if ( HDF5_ENABLE_THREADSAFE )
# check for unsupported options
message ( STATUS " **** thread-safety option not supported with static library **** " )
message ( STATUS " **** thread-safety option will not be used building static library **** " )
if ( HDF5_ENABLE_PARALLEL )
if ( NOT ALLOW_UNSUPPORTED )
message ( FATAL_ERROR " **** parallel and thread-safety options are not supported **** " )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported parallel and thread-safety options **** " )
endif ( NOT ALLOW_UNSUPPORTED )
endif ( HDF5_ENABLE_PARALLEL )
if ( HDF5_BUILD_FORTRAN )
if ( NOT ALLOW_UNSUPPORTED )
message ( FATAL_ERROR " **** Fortran and thread-safety options are not supported **** " )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported Fortran and thread-safety options **** " )
endif ( NOT ALLOW_UNSUPPORTED )
endif ( HDF5_BUILD_FORTRAN )
if ( HDF5_BUILD_CPP_LIB )
if ( NOT ALLOW_UNSUPPORTED )
message ( FATAL_ERROR " **** C++ and thread-safety options are not supported **** " )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported C++ and thread-safety options **** " )
endif ( NOT ALLOW_UNSUPPORTED )
endif ( HDF5_BUILD_CPP_LIB )
if ( HDF5_BUILD_HL_LIB )
if ( NOT ALLOW_UNSUPPORTED )
message ( FATAL_ERROR " **** HL and thread-safety options are not supported **** " )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported HL and thread-safety options **** " )
endif ( NOT ALLOW_UNSUPPORTED )
endif ( HDF5_BUILD_HL_LIB )
if ( H5_HAVE_IOEO )
message ( STATUS " **** Win32 threads requires WINVER>=0x600 (Windows Vista/7/8) **** " )
set ( H5_HAVE_WIN_THREADS 1 )
else ( H5_HAVE_IOEO )
if ( NOT H5_HAVE_PTHREAD_H )
message ( FATAL_ERROR " **** thread-safe option requires Win32 threads or Pthreads **** " )
endif ( NOT H5_HAVE_PTHREAD_H )
endif ( H5_HAVE_IOEO )
set ( THREADS_PREFER_PTHREAD_FLAG ON )
find_package ( Threads )
if ( NOT Threads_FOUND )
message ( STATUS " **** thread-safe package not found - threads still might work **** " )
endif ( NOT Threads_FOUND )
endif ( HDF5_ENABLE_THREADSAFE )
2010-09-11 00:15:34 +08:00
2012-06-14 04:59:24 +08:00
# -----------------------------------------------------------------------
# wrapper script variables
2015-05-15 00:51:20 +08:00
#
2014-03-12 05:14:57 +08:00
#set (CFLAGS "${C_DEFINES}")
#set (CXXFLAGS "${CXX_DEFINES}")
2012-06-14 04:59:24 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Add the HDF5 Library Target to the build
#-----------------------------------------------------------------------------
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /src ${ PROJECT_BINARY_DIR } /src )
2010-05-14 00:01:50 +08:00
2014-03-12 05:14:57 +08:00
if ( HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ" )
if ( ZLIB_FOUND AND ZLIB_USE_EXTERNAL )
2010-09-29 22:47:44 +08:00
ADD_DEPENDENCIES ( ${ HDF5_LIB_TARGET } ZLIB )
2015-08-06 05:01:07 +08:00
if ( BUILD_SHARED_LIBS )
add_dependencies ( ${ HDF5_LIBSH_TARGET } ZLIB )
endif ( BUILD_SHARED_LIBS )
2014-03-12 05:14:57 +08:00
endif ( ZLIB_FOUND AND ZLIB_USE_EXTERNAL )
if ( SZIP_FOUND AND SZIP_USE_EXTERNAL )
2010-09-29 22:47:44 +08:00
ADD_DEPENDENCIES ( ${ HDF5_LIB_TARGET } SZIP )
2015-08-06 05:01:07 +08:00
if ( BUILD_SHARED_LIBS )
add_dependencies ( ${ HDF5_LIBSH_TARGET } SZIP )
endif ( BUILD_SHARED_LIBS )
2014-03-12 05:14:57 +08:00
endif ( SZIP_FOUND AND SZIP_USE_EXTERNAL )
endif ( HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ" )
2010-09-29 03:02:51 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Dashboard and Testing Settings
#-----------------------------------------------------------------------------
2015-04-16 00:59:11 +08:00
option ( BUILD_TESTING "Build HDF5 Unit Testing" ON )
2014-03-12 05:14:57 +08:00
if ( BUILD_TESTING )
set ( DART_TESTING_TIMEOUT 1200
2010-08-10 01:20:38 +08:00
C A C H E I N T E G E R
" T i m e o u t i n s e c o n d s f o r e a c h test ( default 1200=20minutes ) "
)
2015-09-01 04:08:56 +08:00
option ( HDF5_TEST_VFD "Execute tests with different VFDs" OFF )
mark_as_advanced ( HDF5_TEST_VFD )
if ( HDF5_TEST_VFD )
option ( HDF5_TEST_FHEAP_VFD "Execute tests with different VFDs" ON )
mark_as_advanced ( HDF5_TEST_FHEAP_VFD )
endif ( HDF5_TEST_VFD )
option ( HDF_TEST_EXPRESS "Control testing framework (0-3)" "0" )
mark_as_advanced ( HDF_TEST_EXPRESS )
2014-03-19 00:21:46 +08:00
enable_testing ( )
2014-03-12 05:14:57 +08:00
include ( CTest )
2015-09-01 04:08:56 +08:00
2015-09-04 02:28:47 +08:00
include ( ${ HDF5_SOURCE_DIR } /CTestConfig.cmake )
configure_file ( ${ HDF_RESOURCES_DIR } /CTestCustom.cmake ${ HDF5_BINARY_DIR } /CTestCustom.ctest @ONLY )
2014-03-12 05:14:57 +08:00
if ( NOT HDF5_EXTERNALLY_CONFIGURED )
if ( EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test" )
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /tools/lib ${ PROJECT_BINARY_DIR } /tools/lib )
add_subdirectory ( ${ HDF5_SOURCE_DIR } /test ${ PROJECT_BINARY_DIR } /test )
2014-03-12 05:14:57 +08:00
endif ( EXISTS "${HDF5_SOURCE_DIR}/test" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/test" )
if ( H5_HAVE_PARALLEL )
if ( EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar" )
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /testpar ${ PROJECT_BINARY_DIR } /testpar )
2014-03-12 05:14:57 +08:00
endif ( EXISTS "${HDF5_SOURCE_DIR}/testpar" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/testpar" )
endif ( H5_HAVE_PARALLEL )
endif ( NOT HDF5_EXTERNALLY_CONFIGURED )
endif ( BUILD_TESTING )
2010-05-14 00:01:50 +08:00
2015-04-29 05:32:17 +08:00
#-----------------------------------------------------------------------------
# Option to build HDF5 Tools
#-----------------------------------------------------------------------------
if ( EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools" )
option ( HDF5_BUILD_TOOLS "Build HDF5 Tools" ON )
if ( HDF5_BUILD_TOOLS )
add_subdirectory ( ${ HDF5_SOURCE_DIR } /tools ${ PROJECT_BINARY_DIR } /tools )
endif ( HDF5_BUILD_TOOLS )
endif ( EXISTS "${HDF5_SOURCE_DIR}/tools" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/tools" )
2015-03-18 02:59:19 +08:00
#-----------------------------------------------------------------------------
# Option to build examples
#-----------------------------------------------------------------------------
if ( EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples" )
option ( HDF5_BUILD_EXAMPLES "Build HDF5 Library Examples" ON )
if ( HDF5_BUILD_EXAMPLES )
add_subdirectory ( ${ HDF5_SOURCE_DIR } /examples ${ PROJECT_BINARY_DIR } /examples )
endif ( HDF5_BUILD_EXAMPLES )
endif ( EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/examples" )
#-----------------------------------------------------------------------------
# Option to build High Level API's
#-----------------------------------------------------------------------------
if ( EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl" )
option ( HDF5_BUILD_HL_LIB "Build HIGH Level HDF5 Library" ON )
if ( HDF5_BUILD_HL_LIB )
set ( H5_INCLUDE_HL 1 )
add_subdirectory ( ${ HDF5_SOURCE_DIR } /hl ${ PROJECT_BINARY_DIR } /hl )
endif ( HDF5_BUILD_HL_LIB )
endif ( EXISTS "${HDF5_SOURCE_DIR}/hl" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl" )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Option to build Fortran bindings/tests/examples
# Make sure this appears before the CONFIGURE_FILE step
# so that fortran name mangling is detected before writing H5pubconf.h
#-----------------------------------------------------------------------------
2010-08-11 23:06:50 +08:00
# Set default name mangling : overridden by Fortran detection in fortran dir
2014-03-12 05:14:57 +08:00
set ( H5_FC_FUNC "H5_FC_FUNC(name,NAME) name ## _" )
set ( H5_FC_FUNC_ "H5_FC_FUNC_(name,NAME) name ## _" )
if ( EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran" )
option ( HDF5_BUILD_FORTRAN "Build FORTRAN support" OFF )
2015-08-27 00:48:42 +08:00
option ( SKIP_HDF5_FORTRAN_SHARED "Do not build the fortran shared libraries" OFF )
2014-03-12 05:14:57 +08:00
if ( HDF5_BUILD_FORTRAN )
if ( BUILD_SHARED_LIBS AND APPLE )
2015-08-27 00:48:42 +08:00
if ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Shared FORTRAN libraries are unsupported **** " )
set ( SKIP_HDF5_FORTRAN_SHARED ON )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported Fortran shared libraries **** " )
endif ( NOT ALLOW_UNSUPPORTED )
2014-03-12 05:14:57 +08:00
endif ( BUILD_SHARED_LIBS AND APPLE )
2015-02-13 05:52:48 +08:00
option ( HDF5_ENABLE_F2003 "Enable FORTRAN 2003 Standard" ON )
2015-09-04 02:28:47 +08:00
2014-05-15 03:50:28 +08:00
include ( ${ HDF_RESOURCES_EXT_DIR } /HDFUseFortran.cmake )
2015-09-04 02:28:47 +08:00
message ( STATUS "Fortran compiler ID is ${CMAKE_Fortran_COMPILER_ID}" )
# Building with PGI requires CMake 3.3 or greater because previous versions
# of CMake add the wrong compiler flag for the PGI Fortran compiler.
if ( "${CMAKE_Fortran_COMPILER_ID}" MATCHES "PGI" AND "${CMAKE_VERSION}" VERSION_LESS "3.3" )
message ( FATAL_ERROR " **** PGI FORTRAN REQUIRES CMAKE VERSION 3.3 OR GREATER **** " )
endif ( )
2015-08-11 22:35:30 +08:00
include ( ${ HDF_RESOURCES_DIR } /HDF5UseFortran.cmake )
2015-09-04 02:28:47 +08:00
2014-03-12 05:14:57 +08:00
if ( HDF5_ENABLE_F2003 )
if ( NOT FORTRAN_HAVE_ISO_C_BINDING )
set ( HDF5_ENABLE_F2003 OFF )
endif ( NOT FORTRAN_HAVE_ISO_C_BINDING )
endif ( HDF5_ENABLE_F2003 )
2012-06-14 04:59:24 +08:00
# -----------------------------------------------------------------------
# wrapper script variables
2015-05-15 00:51:20 +08:00
#
2014-03-12 05:14:57 +08:00
# set (FCFLAGS "${Fortran_DEFINES}")
2012-06-14 04:59:24 +08:00
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /fortran ${ PROJECT_BINARY_DIR } /fortran )
2014-03-12 05:14:57 +08:00
if ( HDF5_BUILD_HL_LIB )
if ( EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran" )
2010-08-11 23:06:50 +08:00
#-- Build the High Level Fortran source codes
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /hl/fortran ${ PROJECT_BINARY_DIR } /hl/fortran )
2014-03-12 05:14:57 +08:00
endif ( EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran" )
endif ( HDF5_BUILD_HL_LIB )
endif ( HDF5_BUILD_FORTRAN )
endif ( EXISTS "${HDF5_SOURCE_DIR}/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/fortran" )
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Option to build HDF5 C++ Library
#-----------------------------------------------------------------------------
2014-03-12 05:14:57 +08:00
if ( EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" )
2015-03-18 02:59:19 +08:00
option ( HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" ON )
2014-03-12 05:14:57 +08:00
if ( HDF5_BUILD_CPP_LIB )
2010-11-16 00:35:29 +08:00
# check for unsupported options
2014-03-12 05:14:57 +08:00
if ( HDF5_ENABLE_PARALLEL )
2015-08-27 00:48:42 +08:00
if ( NOT ALLOW_UNSUPPORTED )
message ( FATAL_ERROR " **** Parallel and C++ options are mutually exclusive **** " )
else ( NOT ALLOW_UNSUPPORTED )
message ( STATUS " **** Allowing unsupported Parallel and C++ options **** " )
endif ( NOT ALLOW_UNSUPPORTED )
2014-03-12 05:14:57 +08:00
endif ( HDF5_ENABLE_PARALLEL )
if ( CMAKE_NO_STD_NAMESPACE )
set ( H5_NO_STD 1 )
endif ( CMAKE_NO_STD_NAMESPACE )
2014-03-19 00:21:46 +08:00
add_subdirectory ( ${ HDF5_SOURCE_DIR } /c++ ${ PROJECT_BINARY_DIR } /c++ )
2015-03-18 02:59:19 +08:00
if ( HDF5_BUILD_HL_LIB )
if ( EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++" )
#-- Build the High Level Fortran source codes
add_subdirectory ( ${ HDF5_SOURCE_DIR } /hl/c++ ${ PROJECT_BINARY_DIR } /hl/c++ )
endif ( EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++" )
endif ( HDF5_BUILD_HL_LIB )
2014-03-12 05:14:57 +08:00
endif ( HDF5_BUILD_CPP_LIB )
endif ( EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++" )
2010-05-14 00:01:50 +08:00
2014-07-25 01:07:08 +08:00
#-----------------------------------------------------------------------------
2015-05-15 00:51:20 +08:00
# Check if Fortran's default real is double precision. If it is and HL is
2014-07-25 01:07:08 +08:00
# being built then configure should fail due to bug HDFFV-889.
#-----------------------------------------------------------------------------
2016-02-29 10:43:00 +08:00
if ( HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB )
if ( NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE )
message ( FATAL_ERROR " **** Fortran high-level routines are not supported when the default REAL is DOUBLE PRECISION, use HDF5_BUILD_HL_LIB:BOOL=OFF **** " )
endif ( NOT FORTRAN_DEFAULT_REAL_NOT_DOUBLE )
endif ( HDF5_BUILD_FORTRAN AND HDF5_BUILD_HL_LIB )
#-----------------------------------------------------------------------------
# Option to build HDF5 Java Library
#-----------------------------------------------------------------------------
if ( EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java" )
2016-03-01 01:25:27 +08:00
option ( HDF5_BUILD_JAVA "Build Java HDF5 Library" OFF )
2016-02-29 10:43:00 +08:00
if ( HDF5_BUILD_JAVA )
add_subdirectory ( ${ HDF5_SOURCE_DIR } /java ${ PROJECT_BINARY_DIR } /java )
endif ( HDF5_BUILD_JAVA )
endif ( EXISTS "${HDF5_SOURCE_DIR}/java" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/java" )
2014-07-25 01:07:08 +08:00
2010-05-14 00:01:50 +08:00
#-----------------------------------------------------------------------------
# Generate the H5pubconf.h file containing user settings needed by compilation
#-----------------------------------------------------------------------------
2014-05-15 03:50:28 +08:00
configure_file ( ${ HDF_RESOURCES_DIR } /H5pubconf.h.in ${ HDF5_BINARY_DIR } /H5pubconf.h @ONLY )
2010-05-14 00:01:50 +08:00
2014-03-12 05:14:57 +08:00
include ( CMakeInstallation.cmake )