Skip to content
Permalink
Browse files

Added make uninstall rule to CMakeLists.

  • Loading branch information...
matevz committed Dec 7, 2006
1 parent 0417228 commit 871d0d2d60968a9e14e70cde42bc88079ee49e5f
Showing with 31 additions and 0 deletions.
  1. +9 −0 CMakeLists.txt
  2. +22 −0 cmake_uninstall.cmake.in
@@ -8,6 +8,15 @@ PROJECT(Canorus)
# QT4 Support: Requires a very recent version (2.3.4 from March/April 2006)
IF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 2.2)

# Enable make uninstall rule
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY)

ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")

# Set MingW bin dir, if MingW present
IF(MINGW)
STRING(REGEX REPLACE "([^ ]+)/.*" "\\1" MINGW_BIN_DIR "${CMAKE_CXX_COMPILER}")
@@ -0,0 +1,22 @@
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 \"${file}\"")
IF(EXISTS "${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF("${rm_retval}" STREQUAL 0)
ELSE("${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
ENDIF("${rm_retval}" STREQUAL 0)
ELSE(EXISTS "${file}")
MESSAGE(STATUS "File \"${file}\" does not exist.")
ENDIF(EXISTS "${file}")
ENDFOREACH(file)

0 comments on commit 871d0d2

Please sign in to comment.
You can’t perform that action at this time.