Created
July 2, 2012 14:11
-
-
Save royvandam/3033428 to your computer and use it in GitHub Desktop.
Adds an uninstall target to the CMAKE generated Makefile.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Add uninstall target | |
# Requirements: Copy the uninstall.cmake file to the appropriate CMAKE_MODULE_PATH. | |
# | |
add_custom_target(uninstall | |
"${CMAKE_COMMAND}" -P "${CMAKE_MODULE_PATH}/uninstall.cmake" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set(MANIFEST "${CMAKE_CURRENT_BINARY_DIR}/install_manifest.txt") | |
if(NOT EXISTS ${MANIFEST}) | |
message(FATAL_ERROR "Cannot find install manifest: '${MANIFEST}'") | |
endif() | |
file(STRINGS ${MANIFEST} files) | |
foreach(file ${files}) | |
if(EXISTS ${file}) | |
message(STATUS "Removing file: '${file}'") | |
exec_program( | |
${CMAKE_COMMAND} ARGS "-E remove ${file}" | |
OUTPUT_VARIABLE stdout | |
RETURN_VALUE result | |
) | |
if(NOT "${result}" STREQUAL 0) | |
message(FATAL_ERROR "Failed to remove file: '${file}'.") | |
endif() | |
else() | |
MESSAGE(STATUS "File '${file}' does not exist.") | |
endif() | |
endforeach(file) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is licence of this code?