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