diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2010-11-23 21:06:15 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2010-11-23 21:06:15 (GMT) |
commit | 3ceb5f60e9da1ed183ec9e05df3ff16373671d23 (patch) | |
tree | 4e1903281b18dc8fc18563e8124ed1fac59392e7 /CMakeLists.txt | |
parent | 7dd819a85159bbffd24a3a443bd24962884d0319 (diff) | |
download | hdf5-3ceb5f60e9da1ed183ec9e05df3ff16373671d23.zip hdf5-3ceb5f60e9da1ed183ec9e05df3ff16373671d23.tar.gz hdf5-3ceb5f60e9da1ed183ec9e05df3ff16373671d23.tar.bz2 |
[svn-r19838] Correct external library packing for install/cpack
Tested: Windows
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 131 |
1 files changed, 69 insertions, 62 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ca0e7e..06e8316 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -618,41 +618,68 @@ ENDIF (HDF5_ENABLE_SZIP_SUPPORT) #----------------------------------------------------------------------------- # Option for external libraries on windows #----------------------------------------------------------------------------- -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}) +OPTION (HDF5_PACKAGE_EXTLIBS "CPACK - include external libraries" OFF) +IF (HDF5_PACKAGE_EXTLIBS) + SET (EXTERNAL_LIBRARY_LIST "") + SET (EXTERNAL_LIBRARYDLL_LIST "") + IF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + 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") + ADD_DEPENDENCIES (ZLIB-Library-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) - 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}") - GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH) - # MESSAGE (STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}") - ADD_CUSTOM_TARGET (ZLIB-Release-Copy ALL - 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") - ADD_DEPENDENCIES (ZLIB-Release-Copy ZLIB) - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) + IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + 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") + ADD_DEPENDENCIES (SZIP-Library-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + IF (WIN32 AND NOT CYGWIN) + IF (BUILD_SHARED_LIBS) + 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}") + GET_FILENAME_COMPONENT(ZLIB_BIN_PATH ${ZLIB_LIBRARY} PATH) + # MESSAGE (STATUS "ZLIB_BIN_PATH: ${ZLIB_BIN_PATH}") + ADD_CUSTOM_TARGET (ZLIB-Release-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}/" + ) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${ZLIB_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ADD_DEPENDENCIES (ZLIB-Release-Copy ZLIB) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) - IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) - 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: ${SZIP_BIN_PATH}") - ADD_CUSTOM_TARGET (SZIP-Release-Copy ALL - 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") - ADD_DEPENDENCIES (SZIP-Release-Copy SZIP) - ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") - ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + 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: ${SZIP_BIN_PATH}") + ADD_CUSTOM_TARGET (SZIP-Release-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}/" + ) + SET (EXTERNAL_LIBRARYDLL_LIST ${EXTERNAL_LIBRARYDLL_LIST} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${SZIP_DLL_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}) + IF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ADD_DEPENDENCIES (SZIP-Release-Copy SZIP) + ENDIF (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "SVN") + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) - ENDIF (BUILD_SHARED_LIBS) -ENDIF (WIN32 AND NOT CYGWIN) + ENDIF (BUILD_SHARED_LIBS) + ENDIF (WIN32 AND NOT CYGWIN) +ENDIF (HDF5_PACKAGE_EXTLIBS) #----------------------------------------------------------------------------- # Option to use threadsafe @@ -831,22 +858,6 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) - INSTALL( - FILES ${ZLIB_LIBRARY} - DESTINATION ${HDF5_INSTALL_LIB_DIR} - COMPONENT libraries - ) - IF (WIN32 AND 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 (WIN32 AND BUILD_SHARED_LIBS) ENDIF (HDF5_ENABLE_Z_LIB_SUPPORT AND ZLIB_FOUND) IF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) INSTALL ( @@ -854,23 +865,19 @@ IF (NOT HDF5_EXTERNALLY_CONFIGURED) DESTINATION ${HDF5_INSTALL_INCLUDE_DIR} COMPONENT headers ) + ENDIF (HDF5_ENABLE_SZIP_SUPPORT AND SZIP_FOUND) + 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 (WIN32 AND 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 (WIN32 AND 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) |