1*a466cc55SCy Schubert# https://gitlab.kitware.com/cmake/community/wikis/FAQ#can-i-do-make-uninstall-with-cmake 2*a466cc55SCy Schubert 3*a466cc55SCy Schubertif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 4*a466cc55SCy Schubert message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") 5*a466cc55SCy Schubertendif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") 6*a466cc55SCy Schubert 7*a466cc55SCy Schubertfile(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) 8*a466cc55SCy Schubertstring(REGEX REPLACE "\n" ";" files "${files}") 9*a466cc55SCy Schubertforeach(file ${files}) 10*a466cc55SCy Schubert message(STATUS "Uninstalling $ENV{DESTDIR}${file}") 11*a466cc55SCy Schubert if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 12*a466cc55SCy Schubert exec_program( 13*a466cc55SCy Schubert "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" 14*a466cc55SCy Schubert OUTPUT_VARIABLE rm_out 15*a466cc55SCy Schubert RETURN_VALUE rm_retval 16*a466cc55SCy Schubert ) 17*a466cc55SCy Schubert if(NOT "${rm_retval}" STREQUAL 0) 18*a466cc55SCy Schubert message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") 19*a466cc55SCy Schubert endif(NOT "${rm_retval}" STREQUAL 0) 20*a466cc55SCy Schubert else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 21*a466cc55SCy Schubert message(STATUS "File $ENV{DESTDIR}${file} does not exist.") 22*a466cc55SCy Schubert endif(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") 23*a466cc55SCy Schubertendforeach(file) 24