1set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") 2 3if(NOT EXISTS ${MANIFEST}) 4 message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'") 5endif() 6 7file(STRINGS ${MANIFEST} files) 8foreach(file ${files}) 9 if(EXISTS ${file}) 10 message(STATUS "Removing file: '${file}'") 11 12 exec_program( 13 ${CMAKE_COMMAND} ARGS "-E remove ${file}" 14 OUTPUT_VARIABLE stdout 15 RETURN_VALUE result 16 ) 17 18 if(NOT "${result}" STREQUAL 0) 19 message(FATAL_ERROR "Failed to remove file: '${file}'.") 20 endif() 21 else() 22 MESSAGE(STATUS "File '${file}' does not exist.") 23 endif() 24endforeach(file) 25