mirror of
https://github.com/Unidata/netcdf-cxx4.git
synced 2024-11-21 03:13:46 +08:00
Adding install/uninstall framework similar to that found in netcdf-c.
This commit is contained in:
parent
f3a0149c8f
commit
bce2fa6384
130
CMakeInstallation.cmake
Normal file
130
CMakeInstallation.cmake
Normal file
@ -0,0 +1,130 @@
|
||||
#####
|
||||
# Contains variables and settings used
|
||||
# by the CMake build system in order to
|
||||
# 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
|
||||
# Nullsoft Installation System (NSIS)
|
||||
###
|
||||
|
||||
SET(CPACK_PACKAGE_CONTACT "NetCDF Support <support-netcdf@unidata.ucar.edu>")
|
||||
|
||||
IF(WIN32)
|
||||
SET(CPACK_NSIS_MODIFY_PATH ON)
|
||||
SET(CPACK_NSIS_DISPLAY_NAME "NetCDF ${netCDF_VERSION}")
|
||||
SET(CPACK_NSIS_PACKAGE_NAME "NetCDF ${netCDF_VERSION}")
|
||||
SET(CPACK_NSIS_HELP_LINK "http://www.unidata.ucar.edu/netcdf")
|
||||
SET(CPACK_NSIS_URL_INFO_ABOUT "http://www.unidata.ucar.edu/netcdf")
|
||||
SET(CPACK_NSIS_CONTACT "support-netcdf@unidata.ucar.edu")
|
||||
SET(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
||||
SET(CPACK_NSIS_MENU_LINKS
|
||||
"http://www.unidata.ucar.edu/netcdf" "Unidata Website"
|
||||
"http://www.unidata.ucar.edu/netcdf/docs" "NetCDF Stable Documentation"
|
||||
"http://www.unidata.ucar.edu/netcdf/docs_rc" "NetCDF Unstable Documentation")
|
||||
|
||||
ENDIF()
|
||||
|
||||
###
|
||||
# Set debian-specific options used when
|
||||
# creating .deb.
|
||||
#
|
||||
# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators
|
||||
###
|
||||
|
||||
# This should be set using the output of dpkg --print-architecture.
|
||||
FIND_PROGRAM(NC_DPKG NAMES dpkg)
|
||||
IF(NC_DPKG)
|
||||
# Define a macro for getting the dpkg architecture.
|
||||
MACRO(getdpkg_arch arch)
|
||||
exec_program("${NC_DPKG}" ARGS "--print-architecture" OUTPUT_VARIABLE "${arch}")
|
||||
ENDMACRO(getdpkg_arch)
|
||||
getdpkg_arch(dpkg_arch)
|
||||
|
||||
SET(CPACK_DEBIAN_PACKAGE_NAME "netcdf4-dev")
|
||||
SET(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "${dpkg_arch}")
|
||||
SET(CPACK_DEBIAN_PACKAGE_DEPENDS "zlib1g (>= 1:1.2.3.4), libhdf5-7 (>= 1.8.11), libcurl4-openssl-dev (>= 7.22.0)")
|
||||
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(UNIX)
|
||||
SET(CPACK_GENERATOR "STGZ" "TBZ2" "DEB" "ZIP")
|
||||
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)
|
@ -244,6 +244,20 @@ IF(BUILD_SHARED_LIBS)
|
||||
SET(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
||||
ENDIF()
|
||||
|
||||
##
|
||||
# Enable doxygen-generated documentation.
|
||||
##
|
||||
OPTION(NCXX_ENABLE_DOXYGEN "Enable generation of doxygen-based documentation." OFF)
|
||||
IF(NCXX_ENABLE_DOXYGEN)
|
||||
FIND_PACKAGE(Doxygen REQUIRED)
|
||||
FIND_PROGRAM(NCXX_DOT NAMES dot)
|
||||
IF(NCXX_DOT)
|
||||
SET(HAVE_DOT YES CACHE STRING "")
|
||||
ELSE(NCXX_DOT)
|
||||
SET(HAVE_DOT NO CACHE STRING "")
|
||||
ENDIF(NCXX_DOT)
|
||||
ENDIF()
|
||||
|
||||
OPTION(NCXX_ENABLE_TESTS "Enable tests. Run with 'make test'." ON)
|
||||
IF(NCXX_ENABLE_TESTS)
|
||||
# Options for CTest-based tests, dashboards.
|
||||
@ -492,6 +506,10 @@ INSTALL(
|
||||
# End libnetcdf-cxx.settings section.
|
||||
#####
|
||||
|
||||
#####
|
||||
# Options
|
||||
#####
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
|
||||
# Create export configuration
|
||||
@ -520,3 +538,11 @@ INCLUDE_DIRECTORIES(cxx4 examples)
|
||||
|
||||
ADD_SUBDIRECTORY(cxx4)
|
||||
ADD_SUBDIRECTORY(examples)
|
||||
IF(NCXX_ENABLE_DOXYGEN)
|
||||
ADD_SUBDIRECTORY(docs)
|
||||
ENDIF()
|
||||
|
||||
##
|
||||
# CPack, CMakeInstallation.cmake file.
|
||||
##
|
||||
INCLUDE(CMakeInstallation.cmake)
|
||||
|
24
cmake_uninstall.cmake.in
Normal file
24
cmake_uninstall.cmake.in
Normal file
@ -0,0 +1,24 @@
|
||||
CMAKE_POLICY(SET CMP0007 OLD)
|
||||
|
||||
if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||
endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||
|
||||
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||
string(REGEX REPLACE "\n" ";" files "${files}")
|
||||
list(REVERSE files)
|
||||
foreach (file ${files})
|
||||
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
|
||||
if (EXISTS "$ENV{DESTDIR}${file}")
|
||||
execute_process(
|
||||
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
|
||||
OUTPUT_VARIABLE rm_out
|
||||
RESULT_VARIABLE rm_retval
|
||||
)
|
||||
if(NOT ${rm_retval} EQUAL 0)
|
||||
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
|
||||
endif (NOT ${rm_retval} EQUAL 0)
|
||||
else (EXISTS "$ENV{DESTDIR}${file}")
|
||||
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
|
||||
endif (EXISTS "$ENV{DESTDIR}${file}")
|
||||
endforeach(file)
|
Loading…
Reference in New Issue
Block a user