speed-dreams-code/cmake/uninstall.cmake
pouillot b45634ba5c Fixed #59 : add uninstall target to the build system + generate clobber.sh/bat script for full in-source build files cleanup + moved files to the cmake folder
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2727 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: e90d02cad90a1ea3631517e1258951a3b78c6d4c
Former-commit-id: dd41213d98d09050ff7c15ae94e618fa56484ab6
2010-09-07 21:34:19 +00:00

20 lines
1.1 KiB
CMake
Executable file

# CMake script behind the 'uninstall' target.
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_TO_REMOVE)
STRING(REGEX REPLACE "\n" ";" FILES_TO_REMOVE "${FILES_TO_REMOVE}")
FOREACH(FILE_TO_REMOVE ${FILES_TO_REMOVE})
MESSAGE(STATUS "Uninstalling: $ENV{DESTDIR}${FILE_TO_REMOVE}")
IF(EXISTS "$ENV{DESTDIR}${FILE_TO_REMOVE}")
EXEC_PROGRAM("@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${FILE_TO_REMOVE}\""
OUTPUT_VARIABLE RM_OUT RETURN_VALUE RM_RETVAL)
IF(NOT "${RM_RETVAL}" STREQUAL "0")
MESSAGE(FATAL_ERROR "Failed to remove $ENV{DESTDIR}${FILE_TO_REMOVE} (err code ${RM_RETVAL})")
ENDIF(NOT "${RM_RETVAL}" STREQUAL "0")
ELSE(EXISTS "$ENV{DESTDIR}${FILE_TO_REMOVE}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${FILE_TO_REMOVE}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${FILE_TO_REMOVE}")
ENDFOREACH(FILE_TO_REMOVE)