diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2011-02-22 19:37:06 (GMT) |
commit | 727b687ae6c80c9854cb53814fa1c12f27c2994c (patch) | |
tree | fabe359aaddbe3b4d1e2bb58ceb3b94311d66a1c /CMakeLists.txt | |
parent | 25486d50895fa4a30809d289b9aff4de583a9b84 (diff) | |
download | hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.zip hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.gz hdf5-727b687ae6c80c9854cb53814fa1c12f27c2994c.tar.bz2 |
[svn-r20146] Description:
Bring r19714:20145 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.6 (amazon) in debug mode
Mac OS X/32 10.6.6 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 381 |
1 files changed, 267 insertions, 114 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 14633ed..304d86d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,8 @@ PROJECT (HDF5 C CXX) # name conflicts with system versions, then a prefix may be added # to ensure that the correct versions configured are used. # -# HDF5_INSTALL_BIN_DIR, HDF5_INSTALL_LIB_DIR, HDF5_INSTALL_INCLUDE_DIR : -# Customize the 'bin', 'lib', and 'include' installation directories. +# 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. # # HDF5_INSTALL_NO_DEVELOPMENT : # Set to true to skip installation of headers and CMake package files. @@ -69,6 +69,11 @@ PROJECT (HDF5 C CXX) # # Add the sub project # ADD_SUBDIRECTORY(Utilities/hdf5-1.8) #----------------------------------------------------------------------------- +IF (BUILD_SHARED_LIBS) + SET (BUILD_NAME_EXT "SHARED") +ELSE (BUILD_SHARED_LIBS) + SET (BUILD_NAME_EXT "STATIC") +ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- # Set the core names of all the libraries @@ -132,9 +137,6 @@ SET (HDF5_TOOLS_SRC_DIR ${HDF5_SOURCE_DIR}/tools) SET (HDF5_PERFORM_SRC_DIR ${HDF5_SOURCE_DIR}/perform) SET (HDF5_F90_SRC_DIR ${HDF5_SOURCE_DIR}/fortran) -# set default prefix location -SET (CMAKE_INSTALL_PREFIX "./hdf5" CACHE PATH "Install path prefix, prepended onto install directories") - IF (NOT HDF5_INSTALL_BIN_DIR) SET (HDF5_INSTALL_BIN_DIR bin) ENDIF (NOT HDF5_INSTALL_BIN_DIR) @@ -144,6 +146,9 @@ 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) + SET (HDF5_INSTALL_DATA_DIR share) +ENDIF (NOT HDF5_INSTALL_DATA_DIR) #----------------------------------------------------------------------------- # parse the full version number from H5public.h and include in H5_VERS_INFO @@ -165,7 +170,8 @@ 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}") -SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_VERSION_STRING "${HDF5_PACKAGE_VERSION}") +SET (HDF5_PACKAGE_STRING "${HDF5_PACKAGE_NAME} ${HDF5_PACKAGE_VERSION_STRING}") SET (HDF5_PACKAGE_TARNAME "hdf5") SET (HDF5_PACKAGE_URL "http://www.hdfgroup.org") SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org") @@ -234,45 +240,33 @@ SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) SET (LIB_TYPE SHARED) SET (H5_BUILT_AS_DYNAMIC_LIB 1) - IF (MSVC) - SET (CMAKE_MFC_FLAG 0) - FOREACH (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - IF (${flag_var} MATCHES "/MT") - STRING (REGEX REPLACE "/MT" "/MD" ${flag_var} "${${flag_var}}") - ENDIF (${flag_var} MATCHES "/MT") - ENDFOREACH (flag_var) - ENDIF (MSVC) ELSE (BUILD_SHARED_LIBS) + SET (H5_BUILT_AS_STATIC_LIB 1) IF (NOT WIN32) # should this be a user setting : Everyone uses it anyway ? ADD_DEFINITIONS (-DPIC) ENDIF (NOT WIN32) - IF (MSVC) - SET (CMAKE_MFC_FLAG 0) - FOREACH (flag_var - CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE - CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO - CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE - CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) - IF (${flag_var} MATCHES "/MD") - STRING (REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") - ENDIF (${flag_var} MATCHES "/MD") - ENDFOREACH (flag_var) - ENDIF (MSVC) ENDIF (BUILD_SHARED_LIBS) #----------------------------------------------------------------------------- +# Option to Build Static executables +#----------------------------------------------------------------------------- +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) + +#----------------------------------------------------------------------------- # Option to use code coverage #----------------------------------------------------------------------------- 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") - SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-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") + SET (LDFLAGS "${LDFLAGS} -fprofile-arcs -ftest-coverage") ENDIF (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- @@ -280,10 +274,20 @@ ENDIF (HDF5_ENABLE_COVERAGE) #----------------------------------------------------------------------------- OPTION (HDF5_ENABLE_USING_MEMCHECKER "Indicate that a memory checker is used" OFF) IF (HDF5_ENABLE_USING_MEMCHECKER) - SET (H5_USING_MEMCHECKER 1) + SET (H5_USING_MEMCHECKER 1) ENDIF (HDF5_ENABLE_USING_MEMCHECKER) #----------------------------------------------------------------------------- +# Option to use deprecated public API symbols +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_DEPRECATED_SYMBOLS "Enable deprecated public API symbols" ON) +IF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + SET (H5_NO_DEPRECATED_SYMBOLS 0) +ELSE (HDF5_ENABLE_DEPRECATED_SYMBOLS) + SET (H5_NO_DEPRECATED_SYMBOLS 1) +ENDIF (HDF5_ENABLE_DEPRECATED_SYMBOLS) + +#----------------------------------------------------------------------------- # 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 @@ -298,6 +302,10 @@ IF (WIN32) ENDIF (NOT CYGWIN) ENDIF (WIN32) +IF (MSVC) + SET (CMAKE_MFC_FLAG 0) +ENDIF (MSVC) + SET (MAKE_SYSTEM) IF (CMAKE_BUILD_TOOL MATCHES "make") SET (MAKE_SYSTEM 1) @@ -446,16 +454,17 @@ INCLUDE (ExternalProject) OPTION (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building" "NO") OPTION (ZLIB_USE_EXTERNAL "Use External Library Building for ZLIB" 0) OPTION (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0) -IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") +IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") SET (ZLIB_USE_EXTERNAL 1) SET (SZIP_USE_EXTERNAL 1) - IF (NOT ZLIB_SVN_URL) - SET (ZLIB_SVN_URL "http://svn.hdfgroup.uiuc.edu/zlib/trunk") - ENDIF (NOT ZLIB_SVN_URL) - IF (NOT SZIP_SVN_URL) - SET (SZIP_SVN_URL "http://svn.hdfgroup.uiuc.edu/szip/trunk") - ENDIF (NOT SZIP_SVN_URL) -ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (NOT TGZ_PATH) + SET (TGZ_PATH ${HDF5_SOURCE_DIR}) + ENDIF (NOT TGZ_PATH) + SET (ZLIB_TGZ_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME}) + SET (SZIP_TGZ_URL ${TGZ_PATH}/${SZIP_TGZ_NAME}) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") +ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") #----------------------------------------------------------------------------- # Option for ZLib support @@ -471,16 +480,28 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT) SET (H5_HAVE_ZLIB_H 1) SET (H5_HAVE_LIBZ 1) SET (H5_ZLIB_HEADER "zlib.h") + SET (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR}) ELSE (ZLIB_FOUND) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - EXTERNALPROJECT_ADD (ZLIB - SVN_REPOSITORY ${ZLIB_SVN_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBLDTYPE:STRING="Release" - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + EXTERNALPROJECT_ADD (ZLIB + SVN_REPOSITORY ${ZLIB_SVN_URL} + # [SVN_REVISION rev] + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + EXTERNALPROJECT_ADD (ZLIB + #LOG_DOWNLOAD 1 + URL ${ZLIB_TGZ_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNALPROJECT_GET_PROPERTY (ZLIB BINARY_DIR SOURCE_DIR) IF (BUILD_SHARED_LIBS) @@ -518,9 +539,9 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT) SET (H5_HAVE_ZLIB_H 1) SET (H5_HAVE_LIBZ 1) MESSAGE (STATUS "Filter ZLIB is built") - ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") MESSAGE (FATAL " ZLib is Required for ZLib support in HDF5") - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ENDIF (ZLIB_FOUND) ELSE (NOT H5_ZLIB_HEADER) # This project is being called from within another and ZLib is already configured @@ -547,17 +568,30 @@ IF (HDF5_ENABLE_SZIP_SUPPORT) SET (H5_HAVE_FILTER_SZIP 1) SET (H5_HAVE_SZLIB_H 1) SET (H5_HAVE_LIBSZ 1) + SET (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) ELSE (SZIP_FOUND) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - EXTERNALPROJECT_ADD (SZIP - SVN_REPOSITORY ${SZIP_SVN_URL} - # [SVN_REVISION rev] - INSTALL_COMMAND "" - CMAKE_ARGS - -DBLDTYPE:STRING="Release" - -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} - -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} - ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + EXTERNALPROJECT_ADD (SZIP + SVN_REPOSITORY ${SZIP_SVN_URL} + # [SVN_REVISION rev] + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + EXTERNALPROJECT_ADD (SZIP + #LOG_DOWNLOAD 1 + URL ${SZIP_TGZ_URL} + URL_MD5 "" + INSTALL_COMMAND "" + CMAKE_ARGS + -DBUILD_SHARED_LIBS:BOOL=${BUILD_SHARED_LIBS} + -DSZIP_ENABLE_ENCODING:BOOL=${HDF5_ENABLE_SZIP_ENCODING} + ) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") EXTERNALPROJECT_GET_PROPERTY (SZIP BINARY_DIR SOURCE_DIR) @@ -590,9 +624,9 @@ IF (HDF5_ENABLE_SZIP_SUPPORT) SET (H5_HAVE_SZLIB_H 1) SET (H5_HAVE_LIBSZ 1) MESSAGE (STATUS "Filter SZIP is built") - ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ELSE (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") MESSAGE (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ENDIF (SZIP_FOUND) SET (LINK_LIBS ${LINK_LIBS} ${SZIP_LIBRARIES}) INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) @@ -605,11 +639,53 @@ ENDIF (HDF5_ENABLE_SZIP_SUPPORT) #----------------------------------------------------------------------------- # Option for external libraries on windows #----------------------------------------------------------------------------- +OPTION (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) +IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_HEADER_LIST "") + SET (EXTERNAL_LIBRARY_LIST "") + SET (EXTERNAL_LIBRARYDLL_LIST "") + FILE (MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BLDTYPE}) + + IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + ADD_CUSTOM_TARGET (ZLIB-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_INCLUDE_DIR_GEN}/zconf.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/zconf.h) + ADD_CUSTOM_TARGET (ZLIB-Library-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_LIBRARY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_LIBRARY} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + GET_FILENAME_COMPONENT(ZLIB_LIB_NAME ${ZLIB_LIBRARY} NAME) + SET (EXTERNAL_LIBRARY_LIST ${EXTERNAL_LIBRARY_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ZLIB_LIB_NAME}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (ZLIB-GenHeader-Copy ZLIB) + ADD_DEPENDENCIES (ZLIB-Library-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + + IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + ADD_CUSTOM_TARGET (SZIP-GenHeader-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + SET (EXTERNAL_HEADER_LIST ${EXTERNAL_HEADER_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/SZconfig.h) + ADD_CUSTOM_TARGET (SZIP-Library-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_LIBRARY} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_LIBRARY} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + GET_FILENAME_COMPONENT(SZIP_LIB_NAME ${SZIP_LIBRARY} NAME) + SET (EXTERNAL_LIBRARY_LIST ${EXTERNAL_LIBRARY_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_LIB_NAME}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (SZIP-GenHeader-Copy SZIP) + ADD_DEPENDENCIES (SZIP-Library-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) +ENDIF (HDF5_PACKAGE_EXTLIBS) + IF (WIN32 AND NOT CYGWIN) - OPTION (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) IF (BUILD_SHARED_LIBS) FILE (MAKE_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${BLDTYPE}) - IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) GET_FILENAME_COMPONENT(ZLIB_DLL_NAME ${ZLIB_LIBRARY} NAME_WE) # MESSAGE (STATUS "ZLIB_DLL_NAME: ${ZLIB_DLL_NAME}") @@ -619,9 +695,19 @@ IF (WIN32 AND NOT CYGWIN) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ COMMENT "Copying ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/" ) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ADD_DEPENDENCIES (ZLIB-Release-Copy ZLIB) - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + ADD_CUSTOM_TARGET (ZLIB-Dll-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (ZLIB-Dll-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) @@ -633,9 +719,19 @@ IF (WIN32 AND NOT CYGWIN) COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ COMMENT "Copying ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/" ) - IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") ADD_DEPENDENCIES (SZIP-Release-Copy SZIP) - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + ADD_CUSTOM_TARGET (SZIP-Dll-Copy ALL + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/ + COMMENT "Copying ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/" + ) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ADD_DEPENDENCIES (SZIP-Dll-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") + ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) ENDIF (BUILD_SHARED_LIBS) @@ -648,6 +744,10 @@ ENDIF (WIN32 AND NOT CYGWIN) IF (WIN32 AND NOT CYGWIN) OPTION (HDF5_ENABLE_THREADSAFE "Enable Threadsafety" OFF) IF (HDF5_ENABLE_THREADSAFE) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and Threadsafe options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) SET (H5_HAVE_WIN_THREADS 1) SET (H5_HAVE_THREADSAFE 1) ENDIF (HDF5_ENABLE_THREADSAFE) @@ -667,14 +767,14 @@ ENDIF (HDF5_USE_H5DUMP_PACKED_BITS) #----------------------------------------------------------------------------- ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/src) -IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") +IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") IF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) ADD_DEPENDENCIES (${HDF5_LIB_TARGET} ZLIB) ENDIF (ZLIB_FOUND AND ZLIB_USE_EXTERNAL) IF (SZIP_FOUND AND SZIP_USE_EXTERNAL) ADD_DEPENDENCIES (${HDF5_LIB_TARGET} SZIP) ENDIF (SZIP_FOUND AND SZIP_USE_EXTERNAL) -ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") +ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") #----------------------------------------------------------------------------- # Build utility to copy and strip X lines of file @@ -732,11 +832,12 @@ 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) IF (HDF5_BUILD_FORTRAN) + INCLUDE (${HDF5_RESOURCES_DIR}/HDF5UseFortran.cmake) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/fortran ${PROJECT_BINARY_DIR}/fortran) IF (HDF5_BUILD_HL_LIB) IF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") #-- Build the High Level Fortran source codes - ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${HDF5_BINARY_DIR}/hl/fortran) + ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/hl/fortran ${PROJECT_BINARY_DIR}/hl/fortran) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/hl/fortran" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/fortran") ENDIF (HDF5_BUILD_HL_LIB) ENDIF (HDF5_BUILD_FORTRAN) @@ -758,6 +859,10 @@ ENDIF (EXISTS "${HDF5_SOURCE_DIR}/examples" AND IS_DIRECTORY "${HDF5_SOURCE_DIR} IF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") OPTION (HDF5_BUILD_CPP_LIB "Build HDF5 C++ Library" OFF) IF (HDF5_BUILD_CPP_LIB) + # check for unsupported options + IF (HDF5_ENABLE_PARALLEL) + MESSAGE (FATAL " **** Parallel and C++ options are mutually exclusive **** ") + ENDIF (HDF5_ENABLE_PARALLEL) ADD_SUBDIRECTORY (${HDF5_SOURCE_DIR}/c++ ${PROJECT_BINARY_DIR}/c++) ENDIF (HDF5_BUILD_CPP_LIB) ENDIF (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++") @@ -800,56 +905,41 @@ IF (NOT HDF5_INSTALL_NO_DEVELOPMENT) ENDIF (NOT HDF5_INSTALL_NO_DEVELOPMENT) #----------------------------------------------------------------------------- -# Option for external libraries on windows +# Option for external libraries #----------------------------------------------------------------------------- IF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (HDF5_PACKAGE_EXTLIBS) IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) INSTALL ( - FILES ${ZLIB_INCLUDE_DIR_GEN}/zconf.h ${ZLIB_INCLUDE_DIR}/zlib.h + FILES ${ZLIB_INCLUDE_DIR}/zlib.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) - INSTALL( - FILES ${ZLIB_LIBRARY} - DESTINATION ${HDF5_INSTALL_LIB_DIR} - COMPONENT libraries - ) - IF (BUILD_SHARED_LIBS) - GET_FILENAME_COMPONENT(ZLIB_DLL_NAME ${ZLIB_LIBRARY} NAME_WE) - # message(STATUS "ZLIB_DLL_NAME: ${ZLIB_DLL_NAME}") - GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH) - # message(STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}") - INSTALL( - FILES ${ZLIB_BIN_PATH}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${HDF5_INSTALL_BIN_DIR} - COMPONENT libraries - ) - ENDIF (BUILD_SHARED_LIBS) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) INSTALL ( - FILES ${SZIP_INCLUDE_DIR_GEN}/SZconfig.h ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h + FILES ${SZIP_INCLUDE_DIR}/szlib.h ${SZIP_INCLUDE_DIR}/szip_adpt.h ${SZIP_INCLUDE_DIR}/ricehdf.h DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + INSTALL ( + FILES ${EXTERNAL_HEADER_LIST} + DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} + COMPONENT headers + ) + INSTALL( + FILES ${EXTERNAL_LIBRARY_LIST} + DESTINATION ${HDF5_INSTALL_LIB_DIR} + COMPONENT libraries + ) + IF (WIN32 AND BUILD_SHARED_LIBS) INSTALL( - FILES ${SZIP_LIBRARY} - DESTINATION ${HDF5_INSTALL_LIB_DIR} + FILES ${EXTERNAL_LIBRARYDLL_LIST} + DESTINATION ${HDF5_INSTALL_BIN_DIR} COMPONENT libraries ) - IF (BUILD_SHARED_LIBS) - GET_FILENAME_COMPONENT(SZIP_DLL_NAME ${SZIP_LIBRARY} NAME_WE) - # message(STATUS "SZIP_DLL_NAME: ${SZIP_DLL_NAME}") - GET_FILENAME_COMPONENT(SZIP_BIN_PATH ${SZIP_LIBRARY} PATH) - # message(STATUS "SZIP_BIN_PATH: ${ZLIB_BIN_PATH}") - INSTALL( - FILES ${SZIP_BIN_PATH}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${HDF5_INSTALL_BIN_DIR} - COMPONENT libraries - ) - ENDIF (BUILD_SHARED_LIBS) - ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + ENDIF (WIN32 AND BUILD_SHARED_LIBS) ENDIF (HDF5_PACKAGE_EXTLIBS) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -859,7 +949,7 @@ ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) IF (NOT HDF5_EXTERNALLY_CONFIGURED) INSTALL ( EXPORT ${HDF5_EXPORTED_TARGETS} - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} FILE hdf5-targets.cmake ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -900,7 +990,7 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ) INSTALL ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config.cmake - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) @@ -914,27 +1004,86 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) ) INSTALL ( FILES ${HDF5_BINARY_DIR}/CMakeFiles/hdf5-config-version.cmake - DESTINATION ${HDF5_INSTALL_LIB_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/cmake/hdf5-${HDF5_PACKAGE_VERSION} ) ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) #----------------------------------------------------------------------------- +# Add Document File(s) to CMake Install +#----------------------------------------------------------------------------- +IF (NOT HDF5_EXTERNALLY_CONFIGURED) + INSTALL ( + FILES + ${HDF5_SOURCE_DIR}/ACKNOWLEDGMENTS + ${HDF5_SOURCE_DIR}/COPYING + ${HDF5_SOURCE_DIR}/README.txt + DESTINATION ${HDF5_INSTALL_DATA_DIR} + COMPONENT hdfdocuments + ) + IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") + SET (release_files + ${HDF5_SOURCE_DIR}/release_docs/CMake.txt + ${HDF5_SOURCE_DIR}/release_docs/COPYING + ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_9.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL + ${HDF5_SOURCE_DIR}/release_docs/RELEASE.txt + ) + IF (WIN32 AND NOT CYGWIN) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Windows.txt + ) + ELSE (WIN32 AND NOT CYGWIN) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Cygwin.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_MinGW.txt + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_VMS.txt + ) + ENDIF (WIN32 AND NOT CYGWIN) + IF (HDF5_ENABLE_PARALLEL) + SET (release_files + ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_parallel.txt + ) + ENDIF (HDF5_ENABLE_PARALLEL) + INSTALL ( + FILES ${release_files} + DESTINATION ${HDF5_INSTALL_DATA_DIR}/release_docs + COMPONENT hdfdocuments + ) + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/release_docs") +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) + +#----------------------------------------------------------------------------- # Set the cpack variables #----------------------------------------------------------------------------- -IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") +IF (NOT HDF5_EXTERNALLY_CONFIGURED) SET (CPACK_PACKAGE_VENDOR "The HDF Group") SET (CPACK_PACKAGE_NAME "${HDF5_PACKAGE_NAME}") + SET (CPACK_PACKAGE_INSTALL_DIRECTORY "${HDF5_PACKAGE_NAME}") SET (CPACK_PACKAGE_VERSION "${HDF5_PACKAGE_VERSION}") SET (CPACK_PACKAGE_VERSION_MAJOR "${HDF5_PACKAGE_VERSION_MAJOR}") SET (CPACK_PACKAGE_VERSION_MINOR "${HDF5_PACKAGE_VERSION_MINOR}") SET (CPACK_PACKAGE_VERSION_PATCH "") - SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") - + IF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") + SET (CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") + SET (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/COPYING") + SET (CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/release_docs/RELEASE.txt") + ENDIF (EXISTS "${HDF5_SOURCE_DIR}/release_docs") + SET (CPACK_PACKAGE_RELOCATABLE TRUE) + #only needed for cmake 2.8.3 + SET (CPACK_MONOLITHIC_INSTALL 1) IF (WIN32) + SET (CPACK_NSIS_CONTACT "help@hdfgroup.org") + SET (CPACK_NSIS_MODIFY_PATH ON) SET (CPACK_NSIS_PACKAGE_NAME "HDF5 ${HDF5_PACKAGE_VERSION}") + ELSE (WIN32) + SET (CPACK_RPM_COMPONENT_INSTALL ON) ENDIF (WIN32) INCLUDE (CPack) + INCLUDE(InstallRequiredSystemLibraries) #--------------------------------------------------------------------------- # Now list the cpack commands @@ -953,6 +1102,10 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") DEPENDS libraries GROUP Development ) + CPACK_ADD_COMPONENT (hdfdocuments + DISPLAY_NAME "HDF5 Documents" + GROUP Documents + ) IF (HDF5_BUILD_FORTRAN) CPACK_ADD_COMPONENT (fortlibraries @@ -1031,4 +1184,4 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") ) ENDIF (HDF5_BUILD_HL_LIB) -ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED AND EXISTS "${HDF5_SOURCE_DIR}/release_docs") +ENDIF (NOT HDF5_EXTERNALLY_CONFIGURED) |