Add uninstall target to cmake build

This commit is contained in:
Moritz Göbelbecker 2008-05-14 13:00:50 +00:00
parent 50978161c6
commit 303191187a
2 changed files with 42 additions and 3 deletions

View File

@ -1,6 +1,5 @@
# most stuff should be implemented so far, mgoe should know the details (he has done all the work...)
# what is not working so far:
# * fribidi support
# * "uninstall" target
# * Strict compilation (-Werror -Wno-unused -Wno-sign-compare)
# * some other smaller stuff
@ -141,7 +140,10 @@ if(ENABLE_FRIBIDI AND FRIBIDI_LIBRARIES)
add_definitions(-DHAVE_FRIBIDI)
endif(ENABLE_FRIBIDI AND FRIBIDI_LIBRARIES)
#
#create dummy-locales
#
if(ENABLE_DUMMY_LOCALES)
add_definitions(-DUSE_DUMMYLOCALES)
set(DUMMY_LOCALE_C_DIR ${CMAKE_SOURCE_DIR}/locales/C)
@ -185,7 +187,10 @@ if (GETTEXT_FOUND AND ENABLE_NLS)
endif (GETTEXT_FOUND AND ENABLE_NLS)
add_subdirectory(src)
#shrink images
#
# shrink images for tinygui
#
if(GUI STREQUAL "tiny")
FIND_PACKAGE( ImageMagick REQUIRED )
@ -225,11 +230,24 @@ if(ENABLE_SERVER AND FIFO_DIR)
endif(SERVER_UID AND SERVER_GID)
endif(ENABLE_SERVER AND FIFO_DIR)
#
# uninstall
#
configure_file(
"${CMAKE_SOURCE_DIR}/cmake/uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake"
IMMEDIATE @ONLY)
add_custom_target(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake")
#
# Packaging stuff
#
INCLUDE(CPack)
SET(CPACK_GENERATOR "TGZ")
SET(CPACK_SOURCE_GENERATOR "TGZ")

21
cmake/uninstall.cmake.in Normal file
View File

@ -0,0 +1,21 @@
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}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)