File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -85,3 +85,14 @@ if(EXISTS "${GOOGLETEST_ROOT}/CMakeLists.txt")
8585else ()
8686 message (STATUS "Disabling tests" )
8787endif ()
88+
89+ # Confiugure the uninstall script
90+ configure_file (
91+ "${CMAKE_CURRENT_SOURCE_DIR} /cmake/cmake_uninstall.cmake.in"
92+ "${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake"
93+ IMMEDIATE @ONLY
94+ )
95+
96+ # Add uninstall target
97+ add_custom_target (uninstall
98+ COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR} /cmake_uninstall.cmake)
Original file line number Diff line number Diff line change 1+ # Taken from https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
2+
3+ if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
4+ message (FATAL_ERROR "Cannot find install manifest: @CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
5+ endif (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
6+
7+ file (READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files )
8+ string (REGEX REPLACE "\n " ";" files "${files} " )
9+ foreach (file ${files} )
10+ message (STATUS "Uninstalling $ENV{DESTDIR}${file} " )
11+ if (IS_SYMLINK "$ENV{DESTDIR}${file} " OR EXISTS "$ENV{DESTDIR}${file} " )
12+ exec_program (
13+ "@CMAKE_COMMAND@" ARGS "-E remove \" $ENV{DESTDIR}${file} \" "
14+ OUTPUT_VARIABLE rm_out
15+ RETURN_VALUE rm_retval
16+ )
17+ if (NOT "${rm_retval} " STREQUAL 0)
18+ message (FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file} " )
19+ endif (NOT "${rm_retval} " STREQUAL 0)
20+ else (IS_SYMLINK "$ENV{DESTDIR}${file} " OR EXISTS "$ENV{DESTDIR}${file} " )
21+ message (STATUS "File $ENV{DESTDIR}${file} does not exist." )
22+ endif (IS_SYMLINK "$ENV{DESTDIR}${file} " OR EXISTS "$ENV{DESTDIR}${file} " )
23+ endforeach (file)
You can’t perform that action at this time.
0 commit comments