[x265] [PATCH] cmake: add uninstall rule for non-Windows platforms
Steve Borho
steve at borho.org
Sat Oct 12 23:52:25 CEST 2013
# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1381613400 18000
# Sat Oct 12 16:30:00 2013 -0500
# Node ID c18a09b9d2d3c7b249701afedd4e09cf2933312d
# Parent ec98f30c518556476e1ba2acd6c79e38f3b2b137
cmake: add uninstall rule for non-Windows platforms
CMake on Windows doesn't appear to generate an install manifest file
diff -r ec98f30c5185 -r c18a09b9d2d3 source/CMakeLists.txt
--- a/source/CMakeLists.txt Sat Oct 12 14:52:46 2013 -0500
+++ b/source/CMakeLists.txt Sat Oct 12 16:30:00 2013 -0500
@@ -189,6 +189,14 @@
ARCHIVE DESTINATION lib/x265)
install(FILES x265.h "${PROJECT_BINARY_DIR}/x265_config.h" DESTINATION include)
+if(NOT WIN32)
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake"
+ IMMEDIATE @ONLY)
+ add_custom_target(uninstall
+ "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/cmake_uninstall.cmake")
+endif()
+
# Main CLI application
option(ENABLE_CLI "Build standalone CLI application" ON)
if(ENABLE_CLI)
diff -r ec98f30c5185 -r c18a09b9d2d3 source/cmake/cmake_uninstall.cmake.in
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/source/cmake/cmake_uninstall.cmake.in Sat Oct 12 16:30:00 2013 -0500
@@ -0,0 +1,19 @@
+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()
+
+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}" OR IS_SYMLINK "$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()
+ message(STATUS "File "$ENV{DESTDIR}${file}" does not exist.")
+ endif()
+endforeach(file)
More information about the x265-devel
mailing list