summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt167
1 files changed, 12 insertions, 155 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bd1c334..998b5b0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -179,6 +179,7 @@ SET (HDF5_PACKAGE_BUGREPORT "help@hdfgroup.org")
#-----------------------------------------------------------------------------
# Include some macros for reusable code
#-----------------------------------------------------------------------------
+INCLUDE (${HDF5_RESOURCES_DIR}/HDFMacros.cmake)
INCLUDE (${HDF5_RESOURCES_DIR}/HDF5Macros.cmake)
#-----------------------------------------------------------------------------
@@ -457,13 +458,16 @@ OPTION (SZIP_USE_EXTERNAL "Use External Library Building for SZIP" 0)
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 (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
+ IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
+ SET (ZLIB_URL ${ZLIB_SVN_URL})
+ SET (SZIP_URL ${SZIP_SVN_URL})
+ ELSEIF (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")
+ SET (ZLIB_URL ${TGZ_PATH}/${ZLIB_TGZ_NAME})
+ SET (SZIP_URL ${TGZ_PATH}/${SZIP_TGZ_NAME})
+ ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN")
ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ")
#-----------------------------------------------------------------------------
@@ -483,58 +487,7 @@ IF (HDF5_ENABLE_Z_LIB_SUPPORT)
SET (ZLIB_INCLUDE_DIR_GEN ${ZLIB_INCLUDE_DIR})
ELSE (ZLIB_FOUND)
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)
- IF (WIN32 AND NOT MINGW)
- SET (ZLIB_LIBRARY
- "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}zlib1${CMAKE_IMPORT_LIBRARY_SUFFIX}"
- )
- ELSE (WIN32 AND NOT MINGW)
- SET (ZLIB_LIBRARY
- "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}z${CMAKE_SHARED_LIBRARY_SUFFIX}"
- )
- ENDIF (WIN32 AND NOT MINGW)
- ELSE (BUILD_SHARED_LIBS)
- IF (WIN32 AND NOT MINGW)
- IF (HDF_LEGACY_NAMING)
- SET (ZLIB_LIBRARY "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/zlib${CMAKE_STATIC_LIBRARY_SUFFIX}")
- ELSE (HDF_LEGACY_NAMING)
- SET (ZLIB_LIBRARY "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libzlib${CMAKE_STATIC_LIBRARY_SUFFIX}")
- ENDIF (HDF_LEGACY_NAMING)
- ELSE (WIN32 AND NOT MINGW)
- SET (ZLIB_LIBRARY "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libz${CMAKE_STATIC_LIBRARY_SUFFIX}")
- ENDIF (WIN32 AND NOT MINGW)
- ENDIF (BUILD_SHARED_LIBS)
- SET (ZLIB_INCLUDE_DIR_GEN
- "${BINARY_DIR}"
- )
- SET (ZLIB_INCLUDE_DIR
- "${SOURCE_DIR}/src"
- )
-
- SET (ZLIB_FOUND 1)
- SET (ZLIB_LIBRARIES ${ZLIB_LIBRARY})
- SET (ZLIB_INCLUDE_DIRS ${ZLIB_INCLUDE_DIR_GEN} ${ZLIB_INCLUDE_DIR})
+ EXTERNAL_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${ZLIB_URL} ${LIB_TYPE})
SET (H5_HAVE_FILTER_DEFLATE 1)
SET (H5_HAVE_ZLIB_H 1)
SET (H5_HAVE_LIBZ 1)
@@ -571,55 +524,7 @@ IF (HDF5_ENABLE_SZIP_SUPPORT)
SET (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR})
ELSE (SZIP_FOUND)
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)
-
-
- IF (BUILD_SHARED_LIBS)
- IF (WIN32 AND NOT MINGW)
- SET (SZIP_LIBRARY
- "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_IMPORT_LIBRARY_PREFIX}szip${CMAKE_IMPORT_LIBRARY_SUFFIX}"
- )
- ELSE (WIN32 AND NOT MINGW)
- SET (SZIP_LIBRARY
- "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/${CMAKE_SHARED_LIBRARY_PREFIX}szip${CMAKE_SHARED_LIBRARY_SUFFIX}"
- )
- ENDIF (WIN32 AND NOT MINGW)
- ELSE (BUILD_SHARED_LIBS)
- SET (SZIP_LIBRARY
- "${BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/libszip${CMAKE_STATIC_LIBRARY_SUFFIX}"
- )
- ENDIF (BUILD_SHARED_LIBS)
- SET (SZIP_INCLUDE_DIR_GEN
- "${BINARY_DIR}"
- )
- SET (SZIP_INCLUDE_DIR
- "${SOURCE_DIR}/src"
- )
-
- SET (SZIP_FOUND 1)
- SET (SZIP_LIBRARIES ${SZIP_LIBRARY})
- SET (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIR_GEN} ${SZIP_INCLUDE_DIR})
+ EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${SZIP_URL} ${LIB_TYPE} ${HDF5_ENABLE_SZIP_ENCODING})
SET (H5_HAVE_FILTER_SZIP 1)
SET (H5_HAVE_SZLIB_H 1)
SET (H5_HAVE_LIBSZ 1)
@@ -647,39 +552,11 @@ IF (HDF5_PACKAGE_EXTLIBS)
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")
+ PACKAGE_ZLIB_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
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")
+ PACKAGE_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${LIB_TYPE})
ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND)
ENDIF (HDF5_PACKAGE_EXTLIBS)
@@ -698,16 +575,6 @@ IF (WIN32 AND NOT CYGWIN)
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" 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)
@@ -722,16 +589,6 @@ IF (WIN32 AND NOT CYGWIN)
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" 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)