From 1eaa18dbd57a0c609e5fb306158857397aaf2922 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Fri, 5 Dec 2014 11:19:02 -0700 Subject: [PATCH] Moved dependencies into proper location in relation to netcdf.dll to avoid 'can't find hdf5.dll, etc' errors. --- CMakeInstallation.cmake | 75 +++++++++++++++++++++++++++ CMakeLists.txt | 110 +++++++++------------------------------- liblib/CMakeLists.txt | 8 +-- 3 files changed, 101 insertions(+), 92 deletions(-) diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 51c0b460e..27e92ad8c 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -4,6 +4,35 @@ # build binary installers. ##### +SET(CPACK_PACKAGE_VENDOR "Unidata") + +## +# Declare exclusions list used when building a source file. +# NOTE!! This list uses regular expressions, NOT wildcards!! +## +SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}" + "/expecttds3/" + "/nocacheremote3/" + "/nocacheremote4/" + "/special3/" + "${CMAKE_BINARY_DIR}/*" + "/myhtml/*" + "/.svn/" + "my.*\\\\.sh" + "/.deps/" + "/.libs" + "/html/" + ".*\\\\.jar" + ".*\\\\.jdl" + ".*\\\\.sed" + ".*\\\\.proto" + ".*\\\\.texi" + ".*\\\\.example" + "Make0" + "/obsolete/" + "/unknown/" + ".*~" + ) ### # Set options specific to the @@ -25,4 +54,50 @@ IF(WIN32) ENDIF() + +## +# Set Copyright, License info for CPack. +## +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT + ${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt + @ONLY + ) + +SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt") +IF(NOT CPACK_PACK_VERSION) + SET(CPACK_PACKAGE_VERSION ${VERSION}) +ENDIF() + +IF(APPLE) + SET(CPACK_SOURCE_GENERATOR "TGZ") + SET(CPACK_GENERATOR "PackageMaker" "STGZ" "TBZ2" "TGZ" "ZIP") +ENDIF() + +## +# Create an 'uninstall' target. +## +CONFIGURE_FILE( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) + + +ADD_CUSTOM_TARGET(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + +## +# Customize some of the package component descriptions +## + +set(CPACK_COMPONENT_UTILITIES_DESCRIPTION + "The NetCDF-C Utilities") +set(CPACK_COMPONENT_LIBRARIES_DESCRIPTION + "The NetCDF-C Libraries") +set(CPACK_COMPONENT_HEADERS_DESCRIPTION + "Header files for use with NetCDF-C") +set(CPACK_COMPONENT_DEPENDENCIES_DESCRIPTION + "Dependencies for this build of NetCDF-C") +set(CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION + "The NetCDF-C user documentation.") + INCLUDE(CPack) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1440a2c7d..30575220f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1269,13 +1269,27 @@ IF(ENABLE_PNETCDF OR ENABLE_PARALLEL) COMPONENT headers) ENDIF() -# Install the dependencies. This is Windows/Visual studio only, -# and mirrors the configuration used on the build system. It is -# a less-than-optimal system, but it's what we currently have, and -# the only way to avoid making the user build all the dependencies -# themselves. +## +# Brute force, grab all of the dlls from the depency directory, +# install them in the binary dir. Grab all of the .libs, put them +# in the libdir. +## IF(MSVC) - INSTALL(DIRECTORY ${CMAKE_PREFIX_PATH} DESTINATION "deps" COMPONENT dependencies) + FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) + INSTALL(FILES ${COPY_FILES} + DESTINATION ${CMAKE_INSTALL_LIBDIR} + COMPONENT dependencies) + + FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/bin/*.dll) + STRING(REGEX REPLACE "msv[.*].dll" "" COPY_FILES "${COPY_FILES}") + INSTALL(FILES ${COPY_FILES} + DESTINATION ${CMAKE_INSTALL_BINDIR} + COMPONENT dependencies) + + #INSTALL(DIRECTORY ${CMAKE_PREFIX_PATH} DESTINATION "deps" COMPONENT dependencies) + # INSTALL(FILES ${ALL_TLL_LIBS} + # DESTINATION ${CMAKE_INSTALL_LIBDIR} + # COMPONENT dependencies) ENDIF() # Subdirectory CMakeLists.txt files should specify their own @@ -1287,7 +1301,6 @@ CONFIGURE_FILE( ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake @ONLY ) -#INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake) ### # Create pkgconfig files. @@ -1346,83 +1359,9 @@ INSTALL(PROGRAMS ${netCDF_BINARY_DIR}/nc-config # End pkgconfig, nc-config file creation. ### -#### -# End CMake package configuration files. -##### -# Various options for CPACK -##### - ## -# Declare exclusions list used when building a source file. -# NOTE!! This list uses regular expressions, NOT wildcards!! +# Print the configuration summary ## -SET(CPACK_SOURCE_IGNORE_FILES "${CPACK_SOURCE_IGNORE_FILES}" - "/expecttds3/" - "/nocacheremote3/" - "/nocacheremote4/" - "/special3/" - "${CMAKE_BINARY_DIR}/*" - "/myhtml/*" - "/.svn/" - "my.*\\\\.sh" - "/.deps/" - "/.libs" - "/html/" - ".*\\\\.jar" - ".*\\\\.jdl" - ".*\\\\.sed" - ".*\\\\.proto" - ".*\\\\.texi" - ".*\\\\.example" - "Make0" - "/obsolete/" - "/unknown/" - ".*~" - ) - -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/COPYRIGHT - ${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt - @ONLY - ) - -SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_BINARY_DIR}/COPYRIGHT.txt") -IF(NOT CPACK_PACK_VERSION) - SET(CPACK_PACKAGE_VERSION ${VERSION}) -ENDIF() - -IF(APPLE) - SET(CPACK_SOURCE_GENERATOR "TGZ") - SET(CPACK_GENERATOR "PackageMaker" "STGZ" "TBZ2" "TGZ" "ZIP") -ENDIF() - -# Create an 'uninstall' target. -CONFIGURE_FILE( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) - - -ADD_CUSTOM_TARGET(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) - -## Customize some of the package component descriptions -set(CPACK_COMPONENT_UTILITIES_DISPLAY_NAME "netCDF Utilities") -set(CPACK_COMPONENT_LIBRARIES_DISPLAY_NAME "netCDF Libraries") -set(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "netCDF Headers") -set(CPACK_COMPONENT_DEPENDENCIES_DISPLAY_NAME "netCDF Dependencies") -set(CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME "netCDF Documentation") - - -set (CPACK_COMPONENT_UTILITIES_DESCRIPTION - "The netCDF Utilities") -set (CPACK_COMPONENT_LIBRARIES_DESCRIPTION - "The netCDF Libraries") -set (CPACK_COMPONENT_HEADERS_DESCRIPTION - "C header files for use with netCDF") -set (CPACK_COMPONENT_DEPENDENCIES_DESCRIPTION - "Dependencies for this build of netCDF") -set (CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION - "The netCDF user documentation.") print_conf_summary() # Enable Makedist files. @@ -1507,9 +1446,10 @@ FILE(COPY ${netCDF_SOURCE_DIR}/include/netcdf_meta.h # cmake should be able to find netcdf using find_package and find_library. # The EXPORT call is paired with one in liblib. set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/netCDF) + install(EXPORT netCDFTargets DESTINATION ${ConfigPackageLocation} - COMPONENT Devel + COMPONENT headers ) include(CMakePackageConfigHelpers) @@ -1527,7 +1467,7 @@ CONFIGURE_PACKAGE_CONFIG_FILE( INSTALL( FILES "${CMAKE_CURRENT_BINARY_DIR}/netCDFConfig.cmake" DESTINATION "${ConfigPackageLocation}" - COMPONENT Devel + COMPONENT headers ) # Create export configuration @@ -1541,7 +1481,7 @@ install( FILES "${CMAKE_CURRENT_BINARY_DIR}/netCDF/netCDFConfigVersion.cmake" DESTINATION ${ConfigPackageLocation} - COMPONENT Devel + COMPONENT headers ) #### diff --git a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt index 3c34f598e..b091d6928 100644 --- a/liblib/CMakeLists.txt +++ b/liblib/CMakeLists.txt @@ -1,3 +1,4 @@ + SET(liblib_LIBS dispatch netcdf3) ##### @@ -112,13 +113,6 @@ INSTALL( INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -### -# If build fortran, we will want to run a script. -### -#IF(BUILD_FORTRAN) -# INSTALL(SCRIPT "${CMAKE_SOURCE_DIR}/PostInstall.cmake") -#ENDIF(BUILD_FORTRAN) - SET(ALL_TLL_LIBS ${TLL_LIBS} PARENT_SCOPE) SET(NC_LIBS ${NC_LIBS} PARENT_SCOPE)