mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-04-12 18:10:24 +08:00
Added files to support an 'uninstall' target.
This commit is contained in:
parent
448a95d74d
commit
30c2bfac83
@ -425,16 +425,6 @@ CHECK_FUNCTION_EXISTS(getpagesize HAVE_GETPAGESIZE)
|
||||
CHECK_FUNCTION_EXISTS(sysconf HAVE_SYSCONF)
|
||||
CHECK_FUNCTION_EXISTS(mremap HAVE_MREMAP)
|
||||
CHECK_FUNCTION_EXISTS(getrlimit HAVE_GETRLIMIT)
|
||||
#CHECK_FUNCTION_EXISTS(isnan HAVE_DECL_ISNAN_EXISTS)
|
||||
#IF(HAVE_DECL_ISNAN_EXISTS)
|
||||
# SET(HAVE_DECL_ISNAN 1 CACHE STRING "")
|
||||
#ELSE()
|
||||
# SET(HAVE_DECL_ISNAN 0 CACHE STRING "")
|
||||
#ENDIF()
|
||||
#CHECK_FUNCTION_EXISTS(isinf HAVE_DECL_ISINF)
|
||||
|
||||
#CHECK_SYMBOL_EXISTS(RLIM_INFINITY "resource.h" HAVE_RLIM_INFINITY)
|
||||
#INCLUDE_DIRECTORIES(${RESOURCE_H_PATH})
|
||||
#####
|
||||
# End system inspection checks.
|
||||
#####
|
||||
@ -547,18 +537,12 @@ ENDIF()
|
||||
#####
|
||||
# Moving on to CPack, install packages.
|
||||
#####
|
||||
#INSTALL(FILES ${ALL_TLL_LIBS} DESTINATION deps)
|
||||
INSTALL(FILES ${NetCDF_SOURCE_DIR}/include/netcdf.h
|
||||
DESTINATION include)
|
||||
|
||||
INSTALL(FILES ${NetCDF_BINARY_DIR}/config.h
|
||||
DESTINATION include)
|
||||
#INSTALL(FILES ${NetCDF_SOURCE_DIR}/include/netcdf.h
|
||||
# DESTINATION include)
|
||||
FILE(GLOB INC_FILES ${CMAKE_SOURCE_DIR}/include/*.h)
|
||||
INSTALL(FILES ${INC_FILES} DESTINATION include)
|
||||
IF(ENABLE_DOXYGEN)
|
||||
INSTALL(DIRECTORY man4 DESTINATION ".")
|
||||
ENDIF()
|
||||
#INSTALL(FILES ${ALL_TLL_LIBS} DESTINATION deps)
|
||||
|
||||
# Subdirectory CMakeLists.txt files should specify their own
|
||||
# 'install' files.
|
||||
@ -600,7 +584,14 @@ IF(APPLE)
|
||||
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"
|
||||
IMMEDIAGE @ONLY)
|
||||
|
||||
ADD_CUSTOM_TARGET(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
|
||||
print_conf_summary()
|
||||
#MESSAGE(STATUS "CPACK_SOURCE_IGNORE_FILES: ${CPACK_SOURCE_IGNORE_FILES}")
|
||||
|
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…
x
Reference in New Issue
Block a user